/// <summary> /// Initializes a new instance of the <see cref="CacheStore" /> class. /// </summary> /// <param name="store">Store.</param> /// <param name="registry">The handle registry.</param> private CacheStore(ICacheStoreInternal store, HandleRegistry registry) { Debug.Assert(store != null); _store = store; _handle = registry.AllocateCritical(this); }
/// <summary> /// Initializes a new instance of the <see cref="CacheStore" /> class. /// </summary> /// <param name="store">Store.</param> /// <param name="convertBinary">Whether to convert binary objects.</param> /// <param name="registry">The handle registry.</param> private CacheStore(ICacheStore store, bool convertBinary, HandleRegistry registry) { Debug.Assert(store != null); _store = store; _convertBinary = convertBinary; _sesProxy = new CacheStoreSessionProxy(); ResourceProcessor.InjectStoreSession(store, _sesProxy); _handle = registry.AllocateCritical(this); }
/// <summary> /// Prepare lifecycle beans. /// </summary> /// <param name="reader">Reader.</param> /// <param name="outStream">Output stream.</param> /// <param name="handleRegistry">Handle registry.</param> private static void PrepareLifecycleBeans(BinaryReader reader, PlatformMemoryStream outStream, HandleRegistry handleRegistry) { IList <LifecycleBeanHolder> beans = new List <LifecycleBeanHolder> { new LifecycleBeanHolder(new InternalLifecycleBean()) // add internal bean for events }; // 1. Read beans defined in Java. int cnt = reader.ReadInt(); for (int i = 0; i < cnt; i++) { beans.Add(new LifecycleBeanHolder(CreateLifecycleBean(reader))); } // 2. Append beans definied in local configuration. ICollection <ILifecycleBean> nativeBeans = _startup.Configuration.LifecycleBeans; if (nativeBeans != null) { foreach (ILifecycleBean nativeBean in nativeBeans) { beans.Add(new LifecycleBeanHolder(nativeBean)); } } // 3. Write bean pointers to Java stream. outStream.WriteInt(beans.Count); foreach (LifecycleBeanHolder bean in beans) { outStream.WriteLong(handleRegistry.AllocateCritical(bean)); } outStream.SynchronizeOutput(); // 4. Set beans to STARTUP object. _startup.LifecycleBeans = beans; }
/// <summary> /// Registers callback handlers. /// </summary> public long RegisterHandlers(UnmanagedCallbacks cbs) { Debug.Assert(cbs != null); return _callbackRegistry.AllocateCritical(cbs); }
/// <summary> /// Initializes a new instance of the <see cref="CacheStore" /> class. /// </summary> /// <param name="store">Store.</param> /// <param name="convertBinary">Whether to convert binary objects.</param> /// <param name="registry">The handle registry.</param> private CacheStore(ICacheStore store, bool convertBinary, HandleRegistry registry) { Debug.Assert(store != null); _store = store; _convertBinary = convertBinary; _sesProxy = new CacheStoreSessionProxy(); ResourceProcessor.InjectStoreSession(store, _sesProxy); _handle = registry.AllocateCritical(this); }
/// <summary> /// Prepare lifecycle beans. /// </summary> /// <param name="reader">Reader.</param> /// <param name="outStream">Output stream.</param> /// <param name="handleRegistry">Handle registry.</param> private static void PrepareLifecycleBeans(BinaryReader reader, PlatformMemoryStream outStream, HandleRegistry handleRegistry) { IList<LifecycleBeanHolder> beans = new List<LifecycleBeanHolder>(); // 1. Read beans defined in Java. int cnt = reader.ReadInt(); for (int i = 0; i < cnt; i++) beans.Add(new LifecycleBeanHolder(CreateLifecycleBean(reader))); // 2. Append beans definied in local configuration. ICollection<ILifecycleBean> nativeBeans = _startup.Configuration.LifecycleBeans; if (nativeBeans != null) { foreach (ILifecycleBean nativeBean in nativeBeans) beans.Add(new LifecycleBeanHolder(nativeBean)); } // 3. Write bean pointers to Java stream. outStream.WriteInt(beans.Count); foreach (LifecycleBeanHolder bean in beans) outStream.WriteLong(handleRegistry.AllocateCritical(bean)); outStream.SynchronizeOutput(); // 4. Set beans to STARTUP object. _startup.LifecycleBeans = beans; }