Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] ContainerDisconnectedEvent while sending Request

I've found the bug in the meanwhile. The problem was, that I didn't have a public no-arg constructor in every class. While deserializing it threw an IOException which made the SOContainer call disconnect (which isn't IMHO the nicest way to handle this exception - without showing the problem).

On Tue, Sep 28, 2010 at 12:30 PM, Walter Hargassner <walter@xxxxxxxxxxxxxx> wrote:

Hi all,

 

I’m currently working on an application using ECF remoteservice with ecf.generic and declarative services. For our data models we use EMF. On the server side everything works fine (using declarative services) – the container is configured by using the containerfactoryargs property.

 

As EMF models are not serializable out of the box, I created an interface derived from java.io.Externalizable and implemented the methods the following way:

 

  public void writeExternal(ObjectOutput out) throws IOException

  {

    Resource res = new XMIResourceImpl();

    res.getContents().add(EcoreUtil.copy(this));

    ByteArrayOutputStream bos = new ByteArrayOutputStream();

    res.save(bos, null);

    bos.close();

    out.writeObject(bos.toByteArray());

  }

 

  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

  {

    byte[] array = (byte[]) in.readObject();

    ByteArrayInputStream bis = new ByteArrayInputStream(array);

    Resource res = new XMIResourceImpl();

    res.load(bis, null);

    EList<EObject> contents = res.getContents();

    if (contents.size() > 0)

    {

      INSTANCE = (SerializableEObject) contents.get(0);

    }

  }

 

  public Object readResolve() throws ObjectStreamException

  {

    SerializableEObject tmpEObj = INSTANCE;

    INSTANCE = null;

    return tmpEObj;

  }

 

In a unit test serialization and deserialization works fine.

 

Now my problem:

 

If I call a method that doesn’t have an EMF object as parameter, everything works fine. If I call a method with an EMF object, I immediately get a ContainerDisconnectedEvent after the Response has been sent from the server to the client. The client doesn’t seem to receive anything and I get a timeout.

 

Traces on client side:

 

(TRACE)[09/28/10;11:16:06:232]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#callSynch([RemoteServiceRegistrationImpl[remoteServiceID=org.eclipse.ecf.remoteservice.RemoteServiceID[containerID=StringID[ecftcp://localhost:30001/server];containerRelativeID=2];containerID=StringID[ecftcp://localhost:30001/server];serviceid=2;serviceranking=0;classes=[…];state=0;properties={component.id=3, ecf.rsvc.id=2,component.name=…}], org.eclipse.ecf.remoteservice.AbstractRemoteService$2@1d1695e])

(TRACE)[09/28/10;11:16:06:233]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#sendCallRequest([RemoteServiceRegistrationImpl[remoteServiceID=org.eclipse.ecf.remoteservice.RemoteServiceID[containerID=StringID[ecftcp://localhost:30001/server];containerRelativeID=2];containerID=StringID[ecftcp://localhost:30001/server];serviceid=2;serviceranking=0;classes=[…];state=0;properties={component.id=3, ecf.rsvc.id=2, component.name=…}], org.eclipse.ecf.remoteservice.AbstractRemoteService$2@1d1695e])

(TRACE)[09/28/10;11:16:06:236]EXITING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#sendCallRequest(Request[requestId=1;cont=StringID[qDS+EAbBjVJzw+SLWJRlntn869I=];serviceId=2;call=RemoteCallImpl[class=…;method=readElement;params=[…];timeout=30000];done=false;response=null;listener=null])

(TRACE)[09/28/10;11:16:06:236]callSync request sent with requestid=1

(TRACE)[09/28/10;11:16:06:236]Waiting 5000 for response to request: 1

(TRACE)[09/28/10;11:16:07:720]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#handleContainerDisconnectedEvent(ContainerDisconnectedEvent[StringID[qDS+EAbBjVJzw+SLWJRlntn869I=];]StringID[ecftcp://localhost:30001/server];)

(TRACE)[09/28/10;11:16:07:720]TRACING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[qDS+EAbBjVJzw+SLWJRlntn869I=].removePendingContainers(removed containerID=StringID[ecftcp://localhost:30001/server],pendingUpdateContainer={})

(TRACE)[09/28/10;11:16:07:726]EXITING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#handleContainerDisconnectedEvent

(TRACE)[09/28/10;11:16:11:236]Waiting 5000 for response to request: 1

(TRACE)[09/28/10;11:16:16:237]Waiting 5000 for response to request: 1

(TRACE)[09/28/10;11:16:21:237]Waiting 5000 for response to request: 1

(TRACE)[09/28/10;11:16:26:238]Waiting 5000 for response to request: 1

(TRACE)[09/28/10;11:16:31:238]Waiting 5000 for response to request: 1

org.osgi.framework.ServiceException: Service exception on remote service proxy rsid=org.eclipse.ecf.remoteservice.RemoteServiceID[containerID=StringID[ecftcp://localhost:30001/server];containerRelativeID=2]

      at org.eclipse.ecf.remoteservice.AbstractRemoteService.invoke(AbstractRemoteService.java:185)

      at $Proxy0.readElement(Unknown Source)

      …

      at java.lang.Thread.run(Thread.java:619)

Caused by: org.eclipse.ecf.core.util.ECFException: Request timed out after 30000ms

      at org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject.callSynch(RegistrySharedObject.java:629)

      at org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceImpl.callSync(RemoteServiceImpl.java:55)

      at org.eclipse.ecf.remoteservice.AbstractRemoteService.invokeSync(AbstractRemoteService.java:148)

      at org.eclipse.ecf.remoteservice.AbstractRemoteService.invoke(AbstractRemoteService.java:180)

      ... 3 more

Caused by: org.eclipse.equinox.concurrent.future.TimeoutException

      ... 7 more

 

Traces on server side:

 

(TRACE)[09/28/10;11:16:06:238]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.handleEvent()

(TRACE)[09/28/10;11:16:06:239]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.handleSharedObjectMsgEvent()

(TRACE)[09/28/10;11:16:06:239]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.getSharedObjectMsgFromEvent()

(TRACE)[09/28/10;11:16:06:239]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.getSharedObjectMsgFromEvent()

(TRACE)[09/28/10;11:16:06:240]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#handleCallRequest(Request[requestId=1;cont=StringID[qDS+EAbBjVJzw+SLWJRlntn869I=];serviceId=2;call=RemoteCallImpl[class=…;method=readElement;params=[…];timeout=30000];done=false;response=null;listener=null])

(TRACE)[09/28/10;11:16:06:240]EXITING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#handleCallRequest

(TRACE)[09/28/10;11:16:06:240]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.handleSharedObjectMsgEvent()

(TRACE)[09/28/10;11:16:06:240]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.handleEvent()

(TRACE)[09/28/10;11:16:07:625]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#sendCallResponse([StringID[qDS+EAbBjVJzw+SLWJRlntn869I=], Response[requestId=1;response=…);exception=null]])

(TRACE)[09/28/10;11:16:07:625]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.sendSharedObjectMsgTo()

(TRACE)[09/28/10;11:16:07:677]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.sendSharedObjectMsgTo()

(TRACE)[09/28/10;11:16:07:677]EXITING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#sendCallResponse

(TRACE)[09/28/10;11:16:07:715]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.handleEvent()

(TRACE)[09/28/10;11:16:07:715]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#handleContainerDisconnectedEvent(ContainerDisconnectedEvent[StringID[ecftcp://localhost:30001/server];]StringID[qDS+EAbBjVJzw+SLWJRlntn869I=];)

(TRACE)[09/28/10;11:16:07:716]TRACING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[ecftcp://localhost:30001/server].removePendingContainers(removed containerID=StringID[qDS+EAbBjVJzw+SLWJRlntn869I=],pendingUpdateContainer={})

(TRACE)[09/28/10;11:16:07:716]EXITING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#handleContainerDisconnectedEvent

(TRACE)[09/28/10;11:16:07:716]ENTERING org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject#StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter].p.handleEvent()

 

Anyone, any ideas???

 

BTW: If I switch to ecf.r_osgi.peer, I get a java.lang.LinkageError for one of my classes. If I switch to ecf.generic – this error does not come up and the method is called without any problems ;-(

 

BR,

Walter


_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev



Back to the top