/** * Create a new execution control. */ public SimulationService() { this.mode = MODE_NORMAL; this.startoninit = true; this.listeners = SCollection.createArrayList(); }
/** * Clone an index map. */ public Object clone() throws CloneNotSupportedException { IndexMap<K, V> ret = (IndexMap<K, V>) super.clone(); ArrayList<K> listcopy = SCollection.createArrayList(); listcopy.addAll(list); Map<K, V> mapcopy = SCollection.createHashMap(); mapcopy.putAll(map); ret.list = listcopy; ret.map = mapcopy; return ret; // return new IndexMap<K, V>(listcopy, mapcopy); }
/** * Create a new synchronous executor service. */ public SyncExecutionService(IInternalAccess provider, Map<String, Object> properties) { super(provider.getComponentIdentifier(), IExecutionService.class, properties); this.provider = provider; this.state = State.CREATED; this.queue = SCollection.createLinkedHashSet(); this.removedfut = new ArrayList<Future<Void>>(); }
public static void main(String[] args) throws InterruptedException { for(int i=1; i<5000; i++) { createArrayList(); createHashMap(); createHashSet(); createHashtable(); createIndexMap(); createVector(); Thread.sleep(10); } System.out.println("finished"); Thread.sleep(10000); System.exit(0); } }
/** * Create a new component execution service. * @param exta The service provider. */ public DecoupledComponentManagementService(IComponentAdapter root, IBootstrapFactory componentfactory, boolean copy, boolean realtime, boolean uniqueids) { this.root = root; this.componentfactory = componentfactory; this.copy = copy; this.realtime = realtime; this.uniqueids = uniqueids; // Todo: why some collections synchronized? single thread access!? this.adapters = SCollection.createHashMap(); this.ccs = SCollection.createLinkedHashMap(); this.cfs = SCollection.createLinkedHashMap(); // this.logger = Logger.getLogger(AbstractComponentAdapter.getLoggerName(exta.getComponentIdentifier())+".cms"); this.listeners = SCollection.createMultiCollection(); this.resultlisteners = SCollection.createHashMap(); this.initinfos = SCollection.createHashMap(); this.childcounts = SCollection.createHashMap(); this.localtypes = new LRU<Tuple, String>(100); this.lockentries = SCollection.createHashMap(); this.cidcounts = new HashMap<String, Integer>(); }
/** * Add an external document. * @param id The document id as used in anchor tags. * @param doc The html text. */ public void addDocument(String id, String doc) { if(externals==null) this.externals = SCollection.createHashMap(); externals.put(id, doc); }
/** * Create a new cache. */ public ObjectCache(String filename, boolean persist_always, boolean persist_single, int max) { if(!persist_single && filename==null) throw new IllegalArgumentException("Filename must not null when saving to single file."); this.persist_always = persist_always; this.persist_single = persist_single; this.filename = filename; //this.cache = SCollection.createHashMap(); this.cache = SCollection.createLRU(max); }
/** * Create a new threadbased plan executor. */ public JavaStandardPlanExecutor(IThreadPool threadpool) { this.threadpool = threadpool; this.tasks = Collections.synchronizedMap(SCollection.createHashMap()); }
/** * Create a new component execution service. * @param exta The service provider. */ public DecoupledComponentManagementService(IComponentAdapter root, IBootstrapFactory componentfactory, boolean copy, boolean realtime, boolean uniqueids) { this.root = root; this.componentfactory = componentfactory; this.copy = copy; this.realtime = realtime; this.uniqueids = uniqueids; // Todo: why some collections synchronized? single thread access!? this.adapters = SCollection.createHashMap(); this.ccs = SCollection.createLinkedHashMap(); this.cfs = SCollection.createLinkedHashMap(); // this.logger = Logger.getLogger(AbstractComponentAdapter.getLoggerName(exta.getComponentIdentifier())+".cms"); this.listeners = SCollection.createMultiCollection(); this.resultlisteners = SCollection.createHashMap(); this.initinfos = SCollection.createHashMap(); this.childcounts = SCollection.createHashMap(); this.localtypes = new LRU<Tuple, String>(100); this.lockentries = SCollection.createHashMap(); this.cidcounts = new HashMap<String, Integer>(); }
/** * Init the transport. * @param component The platform component. * @param port The port. * @param async true for async mode. */ public TCPTransport(final IInternalAccess component, int port, final boolean async) { this.logger = Logger.getLogger(PlatformComponent.getLoggerName(component.getComponentIdentifier())+".TCPTransport"); this.component = component; this.async = async; this.port = port; // Set up sending side. this.connections = SCollection.createLRU(MAX_CONNECTIONS); ((LRU<String, Object>)this.connections).setCleaner(new ILRUEntryCleaner<String, Object>() { public void cleanupEldestEntry(Entry<String, Object> eldest) { Object con = eldest.getValue(); if(con instanceof TCPOutputConnection) { ((TCPOutputConnection)con).close(); } } }); this.connections = Collections.synchronizedMap(this.connections); }
/** * Create a new players panel. */ public PlayersPanel() { players = SCollection.createArrayList(); }
ArrayList<Map<T, E>> ret = SCollection.createArrayList(); if(names == null || values == null) return ret; + names.length + " " + values.length); HashMap<T, E> binding = SCollection.createHashMap(); Iterator<E>[] iters = new Iterator[values.length];
/** * Create a new asynchronous executor service. */ public AsyncExecutionService(IServiceProvider provider, Map<String, Object> properties)//, int max) { super(provider.getId(), IExecutionService.class, properties); this.provider = provider; this.running = false; this.executors = SCollection.createHashMap(); this.runningexes = SCollection.createHashMap(); }
/** * Create a new component execution service. * @param exta The service provider. */ public ComponentManagementService(IPlatformComponentAccess access, IBootstrapFactory componentfactory, boolean uniqueids) { this.access = access; this.componentfactory = componentfactory; this.uniqueids = uniqueids; this.components = SCollection.createHashMap(); this.ccs = SCollection.createLinkedHashMap(); this.cfs = SCollection.createLinkedHashMap(); // this.logger = Logger.getLogger(AbstractComponentAdapter.getLoggerName(exta.getComponentIdentifier())+".cms"); this.listeners = SCollection.createMultiCollection(); this.initinfos = SCollection.createHashMap(); this.childcounts = SCollection.createHashMap(); this.localtypes = new LRU<Tuple, String>(100); this.lockentries = SCollection.createHashMap(); this.cidcounts = new HashMap<String, Integer>(); putInitInfo(access.getInternalAccess().getComponentIdentifier(), new InitInfo(access, null, null)); }
/** * Create a new synchronous executor service. */ public SyncExecutionService(IServiceProvider provider, Map<String, Object> properties) { super(provider.getId(), IExecutionService.class, properties); this.provider = provider; this.running = false; this.queue = SCollection.createLinkedHashSet(); this.removedfut = new ArrayList<Future<Void>>(); }
/** * Init the transport. * @param platform The platform. * @param settings The settings. */ public TCPTransport(final IServiceProvider container, int port, final boolean async) { this.logger = Logger.getLogger(AbstractComponentAdapter.getLoggerName(container.getId())+".TCPTransport"); this.container = container; this.async = async; this.port = port; // Set up sending side. this.connections = SCollection.createLRU(MAX_CONNECTIONS); ((LRU<String, Object>)this.connections).setCleaner(new ILRUEntryCleaner<String, Object>() { public void cleanupEldestEntry(Entry<String, Object> eldest) { Object con = eldest.getValue(); if(con instanceof TCPOutputConnection) { ((TCPOutputConnection)con).close(); } } }); this.connections = Collections.synchronizedMap(this.connections); }
/** * Create a new execution control. */ public SimulationService() { this.mode = MODE_NORMAL; this.startoninit = true; this.listeners = SCollection.createArrayList(); }
this.transports = SCollection.createArrayList(); for(int i=0; i<transports.length; i++) this.transports.add(transports[i]); this.messagetypes = SCollection.createHashMap(); for(int i=0; i<messagetypes.length; i++) this.messagetypes.put(messagetypes[i].getName(), messagetypes[i]);
/** * Create a new asynchronous executor service. */ public AsyncExecutionService(IInternalAccess component, Map<String, Object> properties)//, int max) { super(component.getComponentIdentifier(), IExecutionService.class, properties); this.component = component; this.executors = SCollection.createHashMap(); this.runningexes = SCollection.createHashMap(); this.state = State.CREATED; }
this.adapters = SCollection.createHashMap(); this.adapters = Collections.synchronizedMap(adapters); this.ccs = SCollection.createLinkedHashMap(); this.cfs = SCollection.createLinkedHashMap(); this.listeners = SCollection.createMultiCollection(); this.resultlisteners = SCollection.createHashMap(); this.resultlisteners = Collections.synchronizedMap(resultlisteners); this.initinfos = SCollection.createHashMap(); this.initinfos = Collections.synchronizedMap(initinfos); this.childcounts = SCollection.createHashMap(); this.localtypes = Collections.synchronizedMap(new LRU<Tuple, String>(100)); this.lockentries = SCollection.createHashMap();