PageRenderTime 53ms CodeModel.GetById 10ms app.highlight 36ms RepoModel.GetById 1ms app.codeStats 0ms

/interpreter/tags/at2dist041108/src/edu/vub/at/actors/natives/ELActor.java

http://ambienttalk.googlecode.com/
Java | 564 lines | 298 code | 46 blank | 220 comment | 14 complexity | cd8b77c9daa2b9e8a42b0f9cc634bd61 MD5 | raw file
  1/**
  2 * AmbientTalk/2 Project
  3 * ELActor.java created on 27-dec-2006 at 16:17:23
  4 * (c) Programming Technology Lab, 2006 - 2007
  5 * Authors: Tom Van Cutsem & Stijn Mostinckx
  6 * 
  7 * Permission is hereby granted, free of charge, to any person
  8 * obtaining a copy of this software and associated documentation
  9 * files (the "Software"), to deal in the Software without
 10 * restriction, including without limitation the rights to use,
 11 * copy, modify, merge, publish, distribute, sublicense, and/or
 12 * sell copies of the Software, and to permit persons to whom the
 13 * Software is furnished to do so, subject to the following
 14 * conditions:
 15 *
 16 * The above copyright notice and this permission notice shall be
 17 * included in all copies or substantial portions of the Software.
 18 *
 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 21 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 26 * OTHER DEALINGS IN THE SOFTWARE.
 27 */
 28package edu.vub.at.actors.natives;
 29
 30
 31import edu.vub.at.actors.ATActorMirror;
 32import edu.vub.at.actors.ATAsyncMessage;
 33import edu.vub.at.actors.ATFarReference;
 34import edu.vub.at.actors.eventloops.BlockingFuture;
 35import edu.vub.at.actors.eventloops.Callable;
 36import edu.vub.at.actors.eventloops.Event;
 37import edu.vub.at.actors.eventloops.EventLoop;
 38import edu.vub.at.actors.id.ATObjectID;
 39import edu.vub.at.actors.id.ActorID;
 40import edu.vub.at.actors.net.comm.Address;
 41import edu.vub.at.eval.Evaluator;
 42import edu.vub.at.exceptions.InterpreterException;
 43import edu.vub.at.exceptions.XClassNotFound;
 44import edu.vub.at.exceptions.XIOProblem;
 45import edu.vub.at.exceptions.XIllegalOperation;
 46import edu.vub.at.exceptions.XObjectOffline;
 47import edu.vub.at.objects.ATAbstractGrammar;
 48import edu.vub.at.objects.ATContext;
 49import edu.vub.at.objects.ATMethod;
 50import edu.vub.at.objects.ATObject;
 51import edu.vub.at.objects.ATTable;
 52import edu.vub.at.objects.ATTypeTag;
 53import edu.vub.at.objects.mirrors.Reflection;
 54import edu.vub.at.objects.natives.NATContext;
 55import edu.vub.at.objects.natives.NATObject;
 56import edu.vub.at.objects.natives.NATTable;
 57import edu.vub.at.objects.natives.OBJLexicalRoot;
 58import edu.vub.at.objects.symbiosis.Symbiosis;
 59import edu.vub.at.util.logging.Logging;
 60
 61import java.lang.reflect.InvocationTargetException;
 62import java.lang.reflect.Method;
 63import java.util.EventListener;
 64
 65/**
 66 * An instance of the class ELActor represents a programmer-defined
 67 * AmbientTalk/2 actor. The event queue of the actor event loop serves as the
 68 * actor's 'meta-level' queue.
 69 *
 70 * The events in the 'meta-level' queue are handled by the actor's mirror object.
 71 * This mirror is normally an instance of NATActorMirror, but it can be any
 72 * programmer-defined object that adheres to the ATActorMirror interface.
 73 *
 74 * @author tvcutsem
 75 */
 76public class ELActor extends EventLoop {
 77	
 78	/**
 79	 * A thread-local variable that contains the 'default actor' to use
 80	 * when there is currently no ELActor event loop thread running.
 81	 * This is primarily useful for performing unit tests where an actor
 82	 * is automatically created when actor semantics is required.
 83	 * 
 84	 * A warning is printed to the log because using the default actor should
 85	 * only be used for testing purposes.
 86	 */
 87	private static final ThreadLocal _DEFAULT_ACTOR_ = new ThreadLocal() {
 88		protected synchronized Object initialValue() {
 89			Logging.Actor_LOG.warn("Creating a default actor for thread " + Thread.currentThread());
 90			try {
 91				ELVirtualMachine host = new ELVirtualMachine(
 92						Evaluator.getNil(),
 93						new SharedActorField[] { },
 94						ELVirtualMachine._DEFAULT_GROUP_NAME_);
 95				return host.createEmptyActor().getFarHost();
 96			} catch (InterpreterException e) {
 97				throw new RuntimeException("Failed to initialize default actor: " + e.getMessage());
 98			}
 99		}
100	};
101	
102	/**
103	 * Retrieves the currently running actor. If there is no running actor thread,
104	 * this returns the value stored in the thread-local default actor field.
105	 */
106	public static final ELActor currentActor() {
107		try {
108			return ((ELActor) EventLoop.currentEventLoop());
109		} catch (ClassCastException e) {
110			// current event loop is not an actor event loop
111		} catch (IllegalStateException e) {
112			// current thread is not an event loop
113		}
114		Logging.Actor_LOG.warn("Asked for an actor in non-actor thread " + Thread.currentThread());
115		return (ELActor) _DEFAULT_ACTOR_.get();
116	}
117
118	private ATActorMirror mirror_;
119	private final ActorID id_;
120	protected final ELVirtualMachine host_;
121	protected final ReceptionistsSet receptionists_;
122	
123	/*
124	 * This object is created when the actor is initialized: i.e. it is the passed
125	 * version of the isolate that was passed to the actor: primitive by the creating actor.
126	 */
127	private NATObject behaviour_;
128	
129	public ELActor(ATActorMirror mirror, ELVirtualMachine host) {
130		super("actor " + mirror.toString());
131		id_ = new ActorID();
132		mirror_ = mirror;
133		host_ = host;
134		receptionists_ = new ReceptionistsSet(this);
135	}
136	
137	/** constructor dedicated to initialization of discovery actor */
138	protected ELActor(ELVirtualMachine host) {
139		super("discovery actor");
140		id_ = new ActorID();
141		mirror_ = new NATActorMirror(host);
142		host_ = host;
143		receptionists_ = new ReceptionistsSet(this);
144	}
145
146	/**
147	 * Actor event loops handle events by allowing the meta-level events to
148	 * process themselves.
149	 */
150	public void handle(Event event) {
151		event.process(mirror_);
152	}
153	
154	public ATActorMirror getImplicitActorMirror() { return mirror_; }
155
156	public void setActorMirror(ATActorMirror mirror) { mirror_ = mirror; }
157	
158	public ELVirtualMachine getHost() {
159		return host_;
160	}
161	
162	public ActorID getActorID() {
163		return id_;
164	}
165	
166	public Thread getExecutor() {
167		return processor_;
168	}
169	
170	/**
171	 * Takes offline a given remote object such that it is no longer remotely accessible.
172	 * @param object a **far?** reference to the object to export
173	 * @throws XIllegalOperation if the passed object is not part of the export table - i.e. non-remotely accessible.
174	 */
175	public void takeOffline(ATObject object) throws InterpreterException {
176		// receptionist set will check whether ATObject is really remote to me
177		receptionists_.takeOfflineObject(object);
178	}
179	
180	/**
181	 * Resolve the given object id into a local reference. There are three cases to
182	 * consider:
183	 *  A) The given id designates an object local to this actor: the returned object
184	 *     will be a **near** reference to the object (i.e. the object itself)
185	 *  B) The given id designates a far (non-local) object that lives in the same
186	 *     address space as this actor: the returned object wil be a **far** reference
187	 *     to the object.
188	 *  C) The given id designates a far object that lives on a remote machine: the
189	 *     returned object will be a **far** and **remote** reference to the object.
190	 *     
191	 * @param id the identifier of the object to resolve
192	 * @return a near or far reference to the object, depending on where the designated object lives
193	 */
194	public ATObject resolve(ATObjectID id, ATTypeTag[] types) throws XObjectOffline {
195		return receptionists_.resolveObject(id, types);
196	}
197	
198	/* -----------------------------
199	 * -- Initialisation Protocol --
200	 * ----------------------------- */
201
202	/**
203	 * Initialises the root using the contents of the init file stored by
204	 * the hosting virtual machine.
205	 * @throws InterpreterException
206	 */
207	protected void initRootObject() throws InterpreterException {
208		ATAbstractGrammar initialisationCode = host_.getInitialisationCode();
209		
210		// evaluate the initialization code in the context of the global scope
211		NATObject globalScope = Evaluator.getGlobalLexicalScope();
212		NATContext initCtx = new NATContext(globalScope, globalScope);
213		
214		initialisationCode.meta_eval(initCtx);
215	}
216	
217	/**
218	 * Initialises various fields in the lexical root of the actor, which are defined in the 
219	 * context of every actor. Candidates are a "system" field which allows the program to 
220	 * perform IO operations or a "~" field denoting the current working directory.
221	 * 
222	 * @throws InterpreterException when initialisation of a field fails
223	 */
224	protected void initSharedFields() throws InterpreterException {
225		SharedActorField[] fields = host_.getFieldsToInitialize();
226		NATObject globalScope = Evaluator.getGlobalLexicalScope();
227		
228		for (int i = 0; i < fields.length; i++) {
229			SharedActorField field = fields[i];
230			ATObject value = field.initialize();
231			if (value != null) {
232				globalScope.meta_defineField(field.getName(), value);
233			}
234		}
235	}
236	
237	// Events to be processed by the actor event loop
238	
239	/**
240	 * The initial event sent by the actor mirror to its event loop to intialize itself.
241	 * @param future the synchronization point with the creating actor, needs to be fulfilled with a far ref to the behaviour.
242	 * @param parametersPkt the serialized parameters for the initialization code
243	 * @param initcodePkt the serialized initialization code (e.g. the code in 'actor: { code }')
244	 */
245	protected void event_init(final BlockingFuture future, final Packet parametersPkt, final Packet initcodePkt) {
246		receive(new Event("init("+this+")") {
247			public void process(Object byMyself) {
248				try {
249					behaviour_ = new NATObject();
250					
251					// pass far ref to behaviour to creator actor who is waiting for this
252					future.resolve(receptionists_.exportObject(behaviour_,"behaviour of "+byMyself));
253					
254					// !! WARNING: the following code is also duplicated in
255					// ELDiscoveryActor's event_init. If this code is modified, don't
256					// forget to modify that of the discovery actor as well !!
257					
258					// initialize lexically visible fields
259					initSharedFields();
260
261					// go on to initialize the root and all lexically visible fields
262					initRootObject();
263
264					ATObject params = parametersPkt.unpack();
265					ATMethod initCode = initcodePkt.unpack().asMethod();					
266				
267					if (!params.isTable()) {
268						// actor initialized as actor: { ... } => free vars automatically added to a private lexical scope
269						// in this case, params refers to an object that will play the role of lexical scope of the actor's behaviour
270						params.asAmbientTalkObject().setLexicalParent(Evaluator.getGlobalLexicalScope());
271						behaviour_.setLexicalParent(params);
272						params = NATTable.EMPTY;
273					}/* else {
274						// actor initialized as actor: { |vars| ... } => vars become publicly accessible in the actor
275					}*/
276					
277					// initialize the behaviour using the parameters and the code
278					try {
279						initCode.base_applyInScope(params.asTable(), new NATContext(behaviour_, behaviour_));
280					} catch (InterpreterException e) {
281						System.out.println(">>> Exception while initializing actor " + Evaluator.trunc(initCode.base_bodyExpression().toString(),20) + ":\n"+e.getMessage());
282						e.printAmbientTalkStackTrace(System.out);
283						Logging.Actor_LOG.error(behaviour_ + ": could not initialize actor behaviour", e);
284					}
285				} catch (InterpreterException e) {
286					System.out.println(">>> Exception while creating actor: " + e.getMessage());
287					e.printAmbientTalkStackTrace(System.out);
288					Logging.Actor_LOG.error(behaviour_ + ": could not initialize actor behaviour", e);
289				}
290			}
291		});
292	}
293	
294	/**
295	 * The main entry point for any asynchronous self-sends.
296	 * Asynchronous self-sends (i.e. intra-actor sends) do not undergo any form of parameter passing,
297	 * there is no need to serialize and deserialize the message parameter in a Packet.
298	 * 
299	 * When an actor receives an asynchronous message for a given receiver, it delegates control
300	 * to the message itself by means of the message's <tt>process</tt> method.
301	 * @throws InterpreterException 
302	 */
303	public void acceptSelfSend(final ATObject receiver, final ATAsyncMessage msg) throws InterpreterException {
304		// This is the only place where messages are scheduled
305		// The receiver is always a local object, receive has
306		// already been invoked.
307    	mirror_.base_schedule(receiver, msg);
308    	// signal a serve event for every message that is accepted
309    	this.event_serve();
310	}
311	
312	/**
313	 * The main entry point for any asynchronous messages sent to this actor
314	 * by external sources.
315	 * @param sender address of the sending actor, used to notify when the receiver has gone offline.
316	 * @param serializedMessage the asynchronous AmbientTalk base-level message to enqueue
317	 */
318	public void event_remoteAccept(final Address sender, final Packet serializedMessage) {
319		receive(new Event("remoteAccept("+serializedMessage+")") {
320			public void process(Object myActorMirror) {
321			  try {
322				// receive a pair [receiver, message]
323				ATObject[] pair = serializedMessage.unpack().asNativeTable().elements_;
324				ATObject receiver = pair[0];
325				ATAsyncMessage msg = pair[1].asAsyncMessage();
326				performAccept(receiver, msg);
327			  } catch (XObjectOffline e) {
328				 host_.event_objectTakenOffline(e.getObjectId(), sender);
329				Logging.Actor_LOG.error(mirror_ + ": error unpacking "+ serializedMessage, e);
330			  }  catch (InterpreterException e) {
331				Logging.Actor_LOG.error(mirror_ + ": error unpacking "+ serializedMessage, e);
332			  } 
333		    }
334		});
335	}
336	
337	/**
338	 * The main entry point for any asynchronous messages sent to this actor 
339	 * by local actors.
340	 * @param ref the local reference of the sending actor, used to notify when the receiver has gone offline.
341	 * @param serializedMessage the asynchronous AmbientTalk base-level message to enqueue
342	 */
343	public void event_localAccept(final NATLocalFarRef ref, final Packet serializedMessage) {
344		receive(new Event("localAccept("+serializedMessage+")") {
345			public void process(Object myActorMirror) {
346			  try {
347				// receive a pair [receiver, message]
348				ATObject[] pair = serializedMessage.unpack().asNativeTable().elements_;
349				ATObject receiver = pair[0];
350				ATAsyncMessage msg = pair[1].asAsyncMessage();
351				performAccept(receiver, msg);
352			  } catch (XObjectOffline e) {
353				  ref.notifyTakenOffline();
354				  Logging.Actor_LOG.error(mirror_ + ": error unpacking "+ serializedMessage, e);
355			  } catch (InterpreterException e) {
356				  Logging.Actor_LOG.error(mirror_ + ": error unpacking "+ serializedMessage, e);
357			  } 
358		    }
359		});
360	}
361	
362	public void event_serve() {
363		receive(new Event("serve()") {
364			public void process(Object myActorMirror) {
365				try {
366					ATObject result = mirror_.base_serve();
367					Logging.Actor_LOG.debug(mirror_ + ": serve() returned " + result);
368				} catch (InterpreterException e) {
369					System.out.println(">>> Exception in actor " + myActorMirror + ": "+e.getMessage());
370					e.printAmbientTalkStackTrace(System.out);
371					Logging.Actor_LOG.error(mirror_ + ": serve() failed ", e);
372				}
373			}
374		});
375	}
376	
377	private void performAccept(ATObject receiver, ATAsyncMessage msg) {
378		try {
379			ATObject result = mirror_.base_receive(receiver, msg);
380			Logging.Actor_LOG.debug(mirror_ + ": scheduling "+ msg + " returned " + result);
381			
382			// signal a serve event for every message that is accepted
383			event_serve();
384		} catch (InterpreterException e) {
385			System.out.println(">>> Exception in actor " + getImplicitActorMirror() + ": "+e.getMessage());
386			e.printAmbientTalkStackTrace(System.out);
387			Logging.Actor_LOG.error(mirror_ + ": scheduling "+ msg + " failed ", e);
388		}
389	}
390	
391	/**
392	 * This method is invoked by a coercer in order to schedule a purely asynchronous symbiotic invocation
393	 * from the Java world.
394	 * 
395	 * This method schedules the call for asynchronous execution. Its return value and or raised exceptions
396	 * are ignored. This method should only be used for {@link Method} objects whose return type is <tt>void</tt>
397	 * and whose declaring class is a subtype of {@link EventListener}. It represents asynchronous method
398	 * invocations from the Java world to the AmbientTalk world.
399	 * 
400	 * @param principal the AmbientTalk object owned by this actor on which to invoke the method
401	 * @param method the Java method that was symbiotically invoked on the principal
402	 * @param args the arguments to the Java method call, already converted into AmbientTalk values
403	 */
404	public void event_symbioticInvocation(final ATObject principal, final Method method, final ATObject[] args) {
405		receive(new Event("asyncSymbioticInv of "+method.getName()) {
406			public void process(Object actorMirror) {
407				try {
408					Reflection.downInvocation(principal, method, args);
409				} catch (InterpreterException e) {
410					System.out.println(">>> Exception in actor " + actorMirror + ": "+e.getMessage());
411					e.printAmbientTalkStackTrace(System.out);
412					Logging.Actor_LOG.error("asynchronous symbiotic invocation of "+method.getName()+" failed", e);
413				}
414			}
415		});
416	}
417	
418	/**
419	 * This method is invoked by a coercer in order to schedule a symbiotic invocation
420	 * from the Java world, which should be synchronous to the Java thread, but which
421	 * must be scheduled asynchronously to comply with the AT/2 actor model.
422	 * 
423	 * The future returned by this method makes the calling (Java) thread <b>block</b> upon
424	 * accessing its value, waiting until the actor has processed the symbiotic invocation.
425	 * 
426	 * @param principal the AmbientTalk object owned by this actor on which to invoke the method
427	 * @param meth the Java method that was symbiotically invoked on the principal
428	 * @param args the arguments to the Java method call, already converted into AmbientTalk values
429	 * @return a Java future that is resolved with the result of the symbiotic invocation
430	 * @throws Exception if the symbiotic invocation fails
431	 */
432	public BlockingFuture sync_event_symbioticInvocation(final ATObject principal, final Method meth, final ATObject[] args) throws Exception {
433		return receiveAndReturnFuture("syncSymbioticInv of " + meth.getName(), new Callable() {
434			public Object call(Object actorMirror) throws Exception {
435				Class targetType = meth.getReturnType();
436				ATObject[] actualArgs = args;
437				// if the return type is BlockingFuture, the first argument should specify the type
438				// of the value with which BlockingFuture will be resolved
439				if (targetType.equals(BlockingFuture.class)) {
440					if ((meth.getParameterTypes().length > 0) && (meth.getParameterTypes()[0].equals(Class.class))) {
441						targetType = args[0].asJavaClassUnderSymbiosis().getWrappedClass();
442						// drop first argument, it only exists to specify the targetType
443						ATObject[] newArgs = new ATObject[args.length-1];
444						System.arraycopy(args, 1, newArgs, 0, newArgs.length);
445						actualArgs = newArgs;
446					}
447				}
448				
449				ATObject result = Reflection.downInvocation(principal, meth, actualArgs);
450				// SUPPORT FOR FUTURES
451				if (Symbiosis.isAmbientTalkFuture(result)) {
452					Logging.Actor_LOG.debug("Symbiotic futures: symbiotic call to " + meth.getName() + " returned an AT future");
453					return Symbiosis.ambientTalkFutureToJavaFuture(result, targetType);
454				} else {
455					// return the proper value immediately
456					return Symbiosis.ambientTalkToJava(result, targetType);
457				}
458			}
459		});
460	}
461	
462	/**
463	 * This method is invoked by a coercer in order to schedule a symbiotic invocation
464	 * of a method from java.lang.Object from the Java world, which should be synchronous
465	 * to the Java thread, but which
466	 * must be scheduled asynchronously to comply with the AT/2 actor model.
467	 * 
468	 * The future returned by this method makes the calling (Java) thread <b>block</b> upon
469	 * accessing its value, waiting until the actor has processed the symbiotic invocation.
470	 * 
471	 * Note: the parameter meth must be a method declared on the class java.lang.Object
472	 * (i.e. toString, hashCode and equals). The invocation is simply forwarded directly
473	 * to the principal with no conversion to an AmbientTalk invocation.
474	 * 
475	 * @param principal the AmbientTalk object owned by this actor on which to invoke the method
476	 * @param meth the Java method that was symbiotically invoked on the principal
477	 * @param args the arguments to the Java method call, already converted into AmbientTalk values
478	 * @return a Java future that is resolved with the result of the symbiotic invocation
479	 * @throws Exception if the symbiotic invocation fails
480	 */
481	public BlockingFuture sync_event_symbioticForwardInvocation(final ATObject principal, final Method meth, final Object[] args) throws Exception {
482		return receiveAndReturnFuture("syncSymbioticInv of " + meth.getName(), new Callable() {
483			public Object call(Object actorMirror) throws Exception {
484				try {
485					return meth.invoke(principal, args);		
486				} catch (InvocationTargetException e) {
487					if (e instanceof Exception) { 
488						throw (Exception) e.getTargetException();
489					} else {
490						throw e;
491					}
492				}
493			}
494		});
495	}
496	
497	/**
498	 * This method should only be used for purposes such as the IAT shell or unit testing.
499	 * It allows an external thread to make this actor evaluate an arbitrary expression.
500	 * 
501	 * @param ast an abstract syntax tree to be evaluated by the receiving actor (in the
502	 * scope of its behaviour).
503	 * @return the result of the evaluation
504	 * @throws InterpreterException if the evaluation fails
505	 */
506	public ATObject sync_event_eval(final ATAbstractGrammar ast) throws InterpreterException {
507		try {
508			return (ATObject) receiveAndWait("nativeEval("+ast+")", new Callable() {
509				public Object call(Object inActor) throws Exception {
510				    return OBJLexicalRoot._INSTANCE_.base_eval_in_(ast, behaviour_);
511				}
512			});
513		} catch (Exception e) {
514			if (e instanceof InterpreterException) {
515				throw (InterpreterException) e;
516			} else {
517				Logging.Actor_LOG.fatal("Unexpected Java exception: "+e.getMessage(), e);
518				throw new RuntimeException("Unexpected exception: "+e);
519			}
520		}
521	}
522	
523	/**
524	 * This method should only be used for purposes of unit testing. It allows
525	 * arbitary code to be scheduled by external threads such as unit testing frameworks.
526	 */
527	public Object sync_event_performTest(Callable c) throws Exception {
528		return (ATObject) receiveAndWait("performTest("+c+")", c);
529	}
530	
531	/**
532	 * When the discovery manager receives a publication from another local actor or
533	 * another remote VM, the actor is asked to compare the incoming publication against
534	 * a subscription that it had announced previously.
535	 * 
536	 * @param requiredTypePkt serialized form of the type attached to the actor's subscription
537	 * @param myHandler the closure specified as a handler for the actor's subscription
538	 * @param discoveredTypePkt serialized form of the type attached to the new publication
539	 * @param remoteServicePkt serialized form of the reference to the remote discovered service
540	 */
541	public void event_serviceJoined(final Packet requiredTypePkt, final ATFarReference myHandler,
542			                        final Packet discoveredTypePkt, final Packet remoteServicePkt) {
543		receive(new Event("serviceJoined") {
544			public void process(Object myActorMirror) {
545				try {
546					ATTypeTag requiredType = requiredTypePkt.unpack().asTypeTag();
547					ATTypeTag discoveredType = discoveredTypePkt.unpack().asTypeTag();
548					// is there a match?
549					if (discoveredType.base_isSubtypeOf(requiredType).asNativeBoolean().javaValue) {
550						ATObject remoteService = remoteServicePkt.unpack();
551						// myhandler<-apply([remoteService])@[]
552						Evaluator.trigger(myHandler, NATTable.of(remoteService));
553					}
554				} catch (XIOProblem e) {
555					Logging.Actor_LOG.error("Error deserializing joined types or services: ", e.getCause());
556				} catch (XClassNotFound e) {
557					Logging.Actor_LOG.fatal("Could not find class while deserializing joined types or services: ", e.getCause());
558				} catch (InterpreterException e) {
559					Logging.Actor_LOG.error("Error while joining services: ", e);
560				}
561			}
562		});
563	}
564}