/// <summary> /// Broadcasts the given <see cref="T:Com.Tridion.Cache.CacheEvent" /> to all other connected clients /// </summary> /// <param name="cacheEvent"><see cref="T:Com.Tridion.Cache.CacheEvent" /></param> public void BroadcastEvent(CacheEvent cacheEvent) { mBroadcastEvent.CallVoid(this, cacheEvent); }
/// <summary> /// Initializes a new instance of the <see cref="CacheChannelEventListenerCallback"/> class. /// </summary> /// <param name="cacheChannelEventListener">The associated <see cref="I:Com.Tridion.Cache.ICacheChannelEventListener" /></param> public CacheChannelEventListenerCallback(ICacheChannelEventListener cacheChannelEventListener) { mCacheChannelEventListener = cacheChannelEventListener; mConnectCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { mCacheChannelEventListener.HandleConnect(); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return(0); }); mDisconnectCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { mCacheChannelEventListener.HandleConnect(); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return(0); }); mRemoteEventCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { CacheEvent typedInstance = (CacheEvent)JavaClass.GetTypedInstance(typeof(CacheEvent), jvalue.From(input).l); mCacheChannelEventListener.HandleRemoteEvent(typedInstance); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return(0); }); base.JObject = mConstructor.construct(0, mConnectCallback, mDisconnectCallback, mRemoteEventCallback); }
/// <summary> /// Process "HandleRemoteEvent" callback from Java /// </summary> /// <param name="cacheEvent">com.tridion.cache.CacheEvent</param> void ICacheChannelEventListener.HandleRemoteEvent(CacheEvent cacheEvent) { if (OnRemoteEvent != null) OnRemoteEvent(this, new CacheEventArgs(cacheEvent.Region, cacheEvent.Key, cacheEvent.EventType)); }
/// <summary> /// Process "HandleRemoteEvent" callback from Java /// </summary> void ICacheChannelEventListener.HandleRemoteEvent(CacheEvent cacheEvent) { mHandleRemoteEvent.CallVoid(this, cacheEvent); }