/** * Create a new introspector. */ public BeanReflectionIntrospector(int lrusize) { this.beaninfos = new LRU<Tuple3<Class<?>, Boolean, Boolean>, Map<String, BeanProperty>>(lrusize); }
/** * Create a new publish service. */ public DefaultRestServicePublishService(IRestMethodGenerator generator) { this.generator = generator; this.proxyclasses = new LRU<Tuple2<Class<?>, Class<?>>, Class<?>>(50); }
/** * Create a new cache. */ public Cache(int max, long ttl) { this(new LRU(max), ttl); }
/** * Return a fresh linked hash map. */ public static <T,E> LRU<T,E> createLRU(int max) { LRU<T,E> ret = new LRU<T,E>(max); if(DEBUG) addCollection(ret); return ret; }
/** * Create a new publish service. */ public AbstractRestServicePublishService(IRestMethodGenerator generator) { this.generator = generator; this.proxyclasses = new LRU<Tuple2<Class<?>, Class<?>>, Class<?>>(50); }
/** * */ public Object getReturnObject(Object object, Class clazz) { Object ret = object; try { ret = clazz.newInstance(); } catch(Exception e) { // Using linked hash map as default to avoid loosing order if has order. ret = new LRU(); } return ret; } }
/** * Load the stored hashes. */ protected static LRU<String, Tuple2<Long, String>> loadHashCache() { LRU<String, Tuple2<Long, String>> ret = null; File cache = new File(JADEXDIR, "hash.cache"); // if(cache.exists()) // { // try // { // FileInputStream fis = new FileInputStream(cache); // ret = (LRU<String, Tuple2<Long, String>>)SBinarySerializer.readObjectFromStream(fis, null, null, null, null, null); // } // catch(Exception e) // { // } // } return ret!=null ? ret : new LRU<String, Tuple2<Long,String>>(1000); }
/** * Creates the object during decoding. * * @param clazz The class of the object. * @param context The decoding context. * @return The created object. */ public Object createObject(Class<?> clazz, IDecodingContext context) { LRU ret = null; try { ret = new LRU(); } catch(Exception e) { if (e instanceof RuntimeException) throw (RuntimeException) e; throw new RuntimeException(e); } return ret; }
/** * Create a model loader. * @param extensions The supported file extensions by order of importance. */ public AbstractModelLoader(String[] extensions, int cachesize) { this.extensions = extensions.clone(); this.modelcache = new LRU<Tuple, ICacheableModel>(cachesize); this.registered = new LinkedHashMap<String, ICacheableModel>(); }
/** * Create a new remote reference module. */ public RemoteReferenceModule(RemoteServiceManagementService rsms, ILibraryService libservice, IMarshalService marshalservice) { this.rsms = rsms; this.libservice = libservice; this.marshalservice = marshalservice; this.timer = new Timer(true); this.proxyinfos = new LRU<Object, ProxyInfo>(200); this.targetobjects = new HashMap<RemoteReference, Object>(); this.targetcomps = new WeakValueMap(); // <RemoteReference, Object> this.remoterefs = new WeakHashMap<Object, RemoteReference> (); this.proxycount = new HashMap<RemoteReference, Integer>(); this.proxydates = new TreeMap<Long, RemoteReference>(); this.holders = new HashMap<RemoteReference, Map<RemoteReferenceHolder, RemoteReferenceHolder>>(); }
/** * Create a new remote reference module. */ public RemoteReferenceModule(RemoteServiceManagementService rsms, ILibraryService libservice, IMarshalService marshalservice) { this.rsms = rsms; this.libservice = libservice; this.marshalservice = marshalservice; this.timer = new Timer(true); this.proxyinfos = new LRU<Object, ProxyInfo>(200); this.targetobjects = new HashMap<RemoteReference, Object>(); this.targetcomps = new WeakValueMap(); // <RemoteReference, Object> this.remoterefs = new WeakHashMap<Object, RemoteReference> (); this.proxycount = new HashMap<RemoteReference, Integer>(); this.proxydates = new TreeMap<Long, RemoteReference>(); this.holders = new HashMap<RemoteReference, Map<RemoteReferenceHolder, RemoteReferenceHolder>>(); }
/** * Create a new remote reference module. */ public RemoteReferenceModule(RemoteServiceManagementService rsms, ILibraryService libservice, IMarshalService marshalservice) { this.rsms = rsms; this.libservice = libservice; this.marshalservice = marshalservice; this.timer = new Timer(true); this.proxyinfos = new LRU<Object, ProxyInfo>(200); this.targetobjects = new HashMap<RemoteReference, Object>(); this.targetcomps = new WeakValueMap(); // <RemoteReference, Object> this.remoterefs = new WeakHashMap<Object, RemoteReference> (); this.proxycount = new HashMap<RemoteReference, Integer>(); this.proxydates = new TreeMap<Long, RemoteReference>(); this.holders = new HashMap<RemoteReference, Map<RemoteReferenceHolder, RemoteReferenceHolder>>(); }
if(reqserprops==null) reqserprops = new LRU<IServiceIdentifier, INFMixedPropertyProvider>(maxreq, new ILRUEntryCleaner<IServiceIdentifier, INFMixedPropertyProvider>()
/** * Create a new remote service management service. */ public RemoteServiceManagementService(IExternalAccess component, ILibraryService libservice, final IMarshalService marshal, final IMessageService msgservice, TransportAddressBook addresses)//, boolean binarymode) { super(component.getComponentIdentifier(), IRemoteServiceManagementService.class, null); // System.out.println("binary: "+binarymode); this.component = component; this.rrm = new RemoteReferenceModule(this, libservice, marshal); this.waitingcalls = new HashMap<String, WaitingCallInfo>(); this.processingcalls = new HashMap<String, Object>(); this.terminationcommands = new LRU<String, List<Runnable>>(1000); this.timer = new Timer(true); this.marshal = marshal; this.msgservice = msgservice; this.addresses = addresses; ((MessageService)msgservice).setContentCodecInfo(component.getComponentIdentifier(), getCodecInfo()); }
/** * Create a new remote service management service. */ public RemoteServiceManagementService(IExternalAccess component, ILibraryService libservice, final IMarshalService marshal, final IMessageService msgservice)//, boolean binarymode) { super(component.getServiceProvider().getId(), IRemoteServiceManagementService.class, null); // System.out.println("binary: "+binarymode); this.component = component; this.rrm = new RemoteReferenceModule(this, libservice, marshal); this.waitingcalls = new HashMap<String, WaitingCallInfo>(); this.processingcalls = new HashMap<String, Object>(); this.terminationcommands = new LRU<String, Runnable>(100); this.timer = new Timer(true); this.marshal = marshal; this.msgservice = msgservice; ((MessageService)msgservice).setContentCodecInfo(component.getComponentIdentifier(), getCodecInfo()); }
/** * Create a new remote service management service. */ public RemoteServiceManagementService(IExternalAccess component, ILibraryService libservice, final IMarshalService marshal, final IMessageService msgservice)//, boolean binarymode) { super(component.getServiceProvider().getId(), IRemoteServiceManagementService.class, null); // System.out.println("binary: "+binarymode); this.component = component; this.rrm = new RemoteReferenceModule(this, libservice, marshal); this.waitingcalls = new HashMap<String, WaitingCallInfo>(); this.processingcalls = new HashMap<String, Object>(); this.terminationcommands = new LRU<String, List<Runnable>>(1000); this.timer = new Timer(true); this.marshal = marshal; this.msgservice = msgservice; ((MessageService)msgservice).setContentCodecInfo(component.getComponentIdentifier(), getCodecInfo()); }
this.initinfos = Collections.synchronizedMap(initinfos); this.childcounts = SCollection.createHashMap(); this.localtypes = Collections.synchronizedMap(new LRU<Tuple, String>(100)); this.lockentries = 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>(); }
/** * 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>(); }
/** * 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)); }