View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
5    */
6   package net.kwfgrid.gworkflowdl.protocol.xupdate;
7   
8   import net.kwfgrid.gworkflowdl.protocol.util.ObjectPool;
9   import net.kwfgrid.jxupdate.xupdate.XUpdateSerializer;
10  
11  /***
12     A pool for instances of <code>XUpdateSerializer</code>. Singleton design-pattern.
13   */
14  public class XUpdateSerializerPool extends ObjectPool {
15      private static int SIZE = 100;
16      private static XUpdateSerializerPool INSTANCE;
17  
18      static {
19  	// configure size! FIXME TODO
20  	// configure prefixes! FIXME TODO
21      }
22  
23      public static synchronized final XUpdateSerializerPool getInstance() {
24  	if (INSTANCE == null) INSTANCE = new XUpdateSerializerPool();
25  	return INSTANCE;
26      }
27  
28      private XUpdateSerializerPool() {
29  	super(SIZE);
30      }
31  
32      protected Object createObject() {
33  	return new XUpdateSerializer();
34      }
35  
36      /***
37         This is a copy of the <code>getObject</code> method just casting the return value
38         to the correct type of this pool.
39       */
40      public XUpdateSerializer getSerializer() throws InterruptedException {
41  	return (XUpdateSerializer)getObject();
42      }
43  }