/// <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); }