Eike Stepper wrote:
hi,

i have a component that should be instantiated with
each service lookup (a channel). but instead it seems
that the second channel is being re-used.

No possible.

it took me a
while, because it changed its state silently.

i use the following code:

  protected Channel createChannel() throws Exception, AssemblyException
  {

    short channelId = findFreeChannelId();
    if (getLogger().isDebugEnabled())
    {
      getLogger().debug("creating new channel with id: " + channelId);
    }

    ReferenceDescriptor reference = new ReferenceDescriptor(Channel.class.getName());
    DeploymentModel component = (DeploymentModel) model.getModel(reference);
    component.commission();

Channel channel = (Channel) component.resolve();

At this point you have a brand-new instance. Basically the code get to the following in DefaultAppliance:

   m_lifestyle.resolve();

WHich invokes resolve in the transient lifestyle handler which in turn established and returns an instance by direct incarnation:

   Object instance = getComponentFactory().incarnate();


    channel.setId(channelId);
    channel.setConnector(this);
    channels.set(channelId, channel);
    return channel;
  }

the following lines in the log show, that a channel that had already
been initialized with a connector + id receives a new id:

[DEBUG  ] (app.Client1): creating new channel with id: 1
[DEBUG  ] (app.net4j.Channel.CLIENT-0:0): received id: 1

Can you post the snippet of code that is generating the log message?

Stephen.


--

|---------------------------------------|
| Magic by Merlin                       |
| Production by Avalon                  |
|                                       |
| http://avalon.apache.org              |
|---------------------------------------|

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to