CDO connetion [message #424445] |
Mon, 27 October 2008 13:44 |
Eclipse User |
|
|
|
Originally posted by: adomas.greicius.nomagic.com
Hello,
I have problem connecting to CDO server. It is strange then run in debug
mode step by step my code it ok. When I run all at once it fail. This line
would not connect Boolean connected = conn.connect(-1); How could be code
improved?
public class ServerManagmenImplTest {
private ServerManagmenImpl serverManagmenImpl;
private CDOSession cdoSession;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
// Send all traces and logs to the console
OMPlatform.INSTANCE.setDebugging(true);
OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
// Use this container to create and wire the components
IManagedContainer container = ContainerUtil.createContainer();
try {
Net4jUtil.prepareContainer(container);
TCPUtil.prepareContainer(container);
LifecycleUtil.activate(container);
CDOUtil.prepareContainer(container); // Register CDO factories
// Create connector
IConnector conn = TCPUtil.getConnector(container, "localhost:2036");
boolean connected = conn.connect(-1);
Adomas Greicius
|
|
|
Re: CDO connetion [message #424446 is a reply to message #424445] |
Mon, 27 October 2008 15:06 |
|
Adomas,
Comments below...
Adomas Greicius schrieb:
> Hello,
>
> I have problem connecting to CDO server. It is strange then run in debug
> mode step by step my code it ok. When I run all at once it fail.
I'd need more info about the concrete problem you're having to finally
judge about it, ideally the stack traces and console logs.
> This line
> would not connect Boolean connected = conn.connect(-1); How could be code
> improved?
>
It looks as if you pull your connector out of a self created
IManagedContainer.
That should be fine (given that the container is properly configured
wqith the needed factories and post processors).
But note that elements that are pulled from such container are
automatically activated after creation.
Activating a connector internally means calling connectAsync().
So you should not call connect() yourself although you might want to
call waitForConnection() after it.
Does this already solve your problem?
Cheers
/Eike
>
> public class ServerManagmenImplTest {
>
>
> private ServerManagmenImpl serverManagmenImpl;
>
>
> private CDOSession cdoSession;
>
>
> @BeforeClass
>
> public static void setUpBeforeClass() throws Exception {
>
>
> }
>
>
> @AfterClass
>
> public static void tearDownAfterClass() throws Exception {
>
> }
>
>
> @Before
>
> public void setUp() throws Exception {
>
>
> // Send all traces and logs to the console
>
> OMPlatform.INSTANCE.setDebugging(true);
>
> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>
> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>
>
> // Use this container to create and wire the components
>
> IManagedContainer container = ContainerUtil.createContainer();
>
>
> try {
>
> Net4jUtil.prepareContainer(container);
>
> TCPUtil.prepareContainer(container);
>
> LifecycleUtil.activate(container);
>
>
> CDOUtil.prepareContainer(container); // Register CDO factories
>
>
> // Create connector
>
> IConnector conn = TCPUtil.getConnector(container, "localhost:2036");
>
>
> boolean connected = conn.connect(-1);
>
>
> Adomas Greicius
>
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: CDO connetion [message #424480 is a reply to message #424446] |
Tue, 28 October 2008 07:35 |
Eclipse User |
|
|
|
Originally posted by: adomas.greicius.nomagic.com
Yes I changed to Boolean connected = conn.connect(2000); and its works fine.
Is -1 value means no time limit?
"Eike Stepper" <stepper@esc-net.de> wrote in message
news:ge4le6$iek$1@build.eclipse.org...
> Adomas,
>
> Comments below...
>
>
>
> Adomas Greicius schrieb:
>> Hello,
>>
>> I have problem connecting to CDO server. It is strange then run in debug
>> mode step by step my code it ok. When I run all at once it fail.
> I'd need more info about the concrete problem you're having to finally
> judge about it, ideally the stack traces and console logs.
>
>
>> This line would not connect Boolean connected = conn.connect(-1); How
>> could be code improved?
>>
> It looks as if you pull your connector out of a self created
> IManagedContainer.
> That should be fine (given that the container is properly configured wqith
> the needed factories and post processors).
>
> But note that elements that are pulled from such container are
> automatically activated after creation.
> Activating a connector internally means calling connectAsync().
> So you should not call connect() yourself although you might want to call
> waitForConnection() after it.
>
> Does this already solve your problem?
>
> Cheers
> /Eike
>
>
>
>>
>> public class ServerManagmenImplTest {
>>
>>
>> private ServerManagmenImpl serverManagmenImpl;
>>
>>
>> private CDOSession cdoSession;
>>
>>
>> @BeforeClass
>>
>> public static void setUpBeforeClass() throws Exception {
>>
>>
>> }
>>
>>
>> @AfterClass
>>
>> public static void tearDownAfterClass() throws Exception {
>>
>> }
>>
>>
>> @Before
>>
>> public void setUp() throws Exception {
>>
>>
>> // Send all traces and logs to the console
>>
>> OMPlatform.INSTANCE.setDebugging(true);
>>
>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>>
>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>>
>>
>> // Use this container to create and wire the components
>>
>> IManagedContainer container = ContainerUtil.createContainer();
>>
>>
>> try {
>>
>> Net4jUtil.prepareContainer(container);
>>
>> TCPUtil.prepareContainer(container);
>>
>> LifecycleUtil.activate(container);
>>
>>
>> CDOUtil.prepareContainer(container); // Register CDO factories
>>
>>
>> // Create connector
>>
>> IConnector conn = TCPUtil.getConnector(container, "localhost:2036");
>>
>>
>> boolean connected = conn.connect(-1);
>>
>>
>> Adomas Greicius
>>
>>
|
|
|
Re: CDO connetion [message #424481 is a reply to message #424446] |
Tue, 28 October 2008 07:39 |
Eclipse User |
|
|
|
Originally posted by: adomas.greicius.nomagic.com
Method connect() call two method connectAsync() and after
waitForConnection() . So it's no use to call waitForConnection() after
connect().
"Eike Stepper" <stepper@esc-net.de> wrote in message
news:ge4le6$iek$1@build.eclipse.org...
> Adomas,
>
> Comments below...
>
>
>
> Adomas Greicius schrieb:
>> Hello,
>>
>> I have problem connecting to CDO server. It is strange then run in debug
>> mode step by step my code it ok. When I run all at once it fail.
> I'd need more info about the concrete problem you're having to finally
> judge about it, ideally the stack traces and console logs.
>
>
>> This line would not connect Boolean connected = conn.connect(-1); How
>> could be code improved?
>>
> It looks as if you pull your connector out of a self created
> IManagedContainer.
> That should be fine (given that the container is properly configured wqith
> the needed factories and post processors).
>
> But note that elements that are pulled from such container are
> automatically activated after creation.
> Activating a connector internally means calling connectAsync().
> So you should not call connect() yourself although you might want to call
> waitForConnection() after it.
>
> Does this already solve your problem?
>
> Cheers
> /Eike
>
>
>
>>
>> public class ServerManagmenImplTest {
>>
>>
>> private ServerManagmenImpl serverManagmenImpl;
>>
>>
>> private CDOSession cdoSession;
>>
>>
>> @BeforeClass
>>
>> public static void setUpBeforeClass() throws Exception {
>>
>>
>> }
>>
>>
>> @AfterClass
>>
>> public static void tearDownAfterClass() throws Exception {
>>
>> }
>>
>>
>> @Before
>>
>> public void setUp() throws Exception {
>>
>>
>> // Send all traces and logs to the console
>>
>> OMPlatform.INSTANCE.setDebugging(true);
>>
>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>>
>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>>
>>
>> // Use this container to create and wire the components
>>
>> IManagedContainer container = ContainerUtil.createContainer();
>>
>>
>> try {
>>
>> Net4jUtil.prepareContainer(container);
>>
>> TCPUtil.prepareContainer(container);
>>
>> LifecycleUtil.activate(container);
>>
>>
>> CDOUtil.prepareContainer(container); // Register CDO factories
>>
>>
>> // Create connector
>>
>> IConnector conn = TCPUtil.getConnector(container, "localhost:2036");
>>
>>
>> boolean connected = conn.connect(-1);
>>
>>
>> Adomas Greicius
>>
>>
|
|
|
Re: CDO connetion [message #424482 is a reply to message #424481] |
Tue, 28 October 2008 07:50 |
|
Adomas Greicius schrieb:
> Method connect() call two method connectAsync() and after
> waitForConnection() . So it's no use to call waitForConnection() after
> connect().
>
No, but if you pull the connector out of a managed container this
container will call activate() which, in turn, will call connectAsync()
and then it could make sense to waitForConnection(timeout) ;-)
Cheers
/Eike
> "Eike Stepper" <stepper@esc-net.de> wrote in message
> news:ge4le6$iek$1@build.eclipse.org...
>
>> Adomas,
>>
>> Comments below...
>>
>>
>>
>> Adomas Greicius schrieb:
>>
>>> Hello,
>>>
>>> I have problem connecting to CDO server. It is strange then run in debug
>>> mode step by step my code it ok. When I run all at once it fail.
>>>
>> I'd need more info about the concrete problem you're having to finally
>> judge about it, ideally the stack traces and console logs.
>>
>>
>>
>>> This line would not connect Boolean connected = conn.connect(-1); How
>>> could be code improved?
>>>
>>>
>> It looks as if you pull your connector out of a self created
>> IManagedContainer.
>> That should be fine (given that the container is properly configured wqith
>> the needed factories and post processors).
>>
>> But note that elements that are pulled from such container are
>> automatically activated after creation.
>> Activating a connector internally means calling connectAsync().
>> So you should not call connect() yourself although you might want to call
>> waitForConnection() after it.
>>
>> Does this already solve your problem?
>>
>> Cheers
>> /Eike
>>
>>
>>
>>
>>> public class ServerManagmenImplTest {
>>>
>>>
>>> private ServerManagmenImpl serverManagmenImpl;
>>>
>>>
>>> private CDOSession cdoSession;
>>>
>>>
>>> @BeforeClass
>>>
>>> public static void setUpBeforeClass() throws Exception {
>>>
>>>
>>> }
>>>
>>>
>>> @AfterClass
>>>
>>> public static void tearDownAfterClass() throws Exception {
>>>
>>> }
>>>
>>>
>>> @Before
>>>
>>> public void setUp() throws Exception {
>>>
>>>
>>> // Send all traces and logs to the console
>>>
>>> OMPlatform.INSTANCE.setDebugging(true);
>>>
>>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>>>
>>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>>>
>>>
>>> // Use this container to create and wire the components
>>>
>>> IManagedContainer container = ContainerUtil.createContainer();
>>>
>>>
>>> try {
>>>
>>> Net4jUtil.prepareContainer(container);
>>>
>>> TCPUtil.prepareContainer(container);
>>>
>>> LifecycleUtil.activate(container);
>>>
>>>
>>> CDOUtil.prepareContainer(container); // Register CDO factories
>>>
>>>
>>> // Create connector
>>>
>>> IConnector conn = TCPUtil.getConnector(container, "localhost:2036");
>>>
>>>
>>> boolean connected = conn.connect(-1);
>>>
>>>
>>> Adomas Greicius
>>>
>>>
>>>
>
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: CDO connetion [message #424483 is a reply to message #424480] |
Tue, 28 October 2008 07:52 |
|
Adomas Greicius schrieb:
> Yes I changed to Boolean connected = conn.connect(2000); and its works fine.
> Is -1 value means no time limit?
>
Currently we have no symbolic constant for "no timeout" and the
behaviour of a -1 timeout is not specified.
Please file an enhancement request if you need such behaviour and we'll
provide it ASAP.
Cheers
/Eike
> "Eike Stepper" <stepper@esc-net.de> wrote in message
> news:ge4le6$iek$1@build.eclipse.org...
>
>> Adomas,
>>
>> Comments below...
>>
>>
>>
>> Adomas Greicius schrieb:
>>
>>> Hello,
>>>
>>> I have problem connecting to CDO server. It is strange then run in debug
>>> mode step by step my code it ok. When I run all at once it fail.
>>>
>> I'd need more info about the concrete problem you're having to finally
>> judge about it, ideally the stack traces and console logs.
>>
>>
>>
>>> This line would not connect Boolean connected = conn.connect(-1); How
>>> could be code improved?
>>>
>>>
>> It looks as if you pull your connector out of a self created
>> IManagedContainer.
>> That should be fine (given that the container is properly configured wqith
>> the needed factories and post processors).
>>
>> But note that elements that are pulled from such container are
>> automatically activated after creation.
>> Activating a connector internally means calling connectAsync().
>> So you should not call connect() yourself although you might want to call
>> waitForConnection() after it.
>>
>> Does this already solve your problem?
>>
>> Cheers
>> /Eike
>>
>>
>>
>>
>>> public class ServerManagmenImplTest {
>>>
>>>
>>> private ServerManagmenImpl serverManagmenImpl;
>>>
>>>
>>> private CDOSession cdoSession;
>>>
>>>
>>> @BeforeClass
>>>
>>> public static void setUpBeforeClass() throws Exception {
>>>
>>>
>>> }
>>>
>>>
>>> @AfterClass
>>>
>>> public static void tearDownAfterClass() throws Exception {
>>>
>>> }
>>>
>>>
>>> @Before
>>>
>>> public void setUp() throws Exception {
>>>
>>>
>>> // Send all traces and logs to the console
>>>
>>> OMPlatform.INSTANCE.setDebugging(true);
>>>
>>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);
>>>
>>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>>>
>>>
>>> // Use this container to create and wire the components
>>>
>>> IManagedContainer container = ContainerUtil.createContainer();
>>>
>>>
>>> try {
>>>
>>> Net4jUtil.prepareContainer(container);
>>>
>>> TCPUtil.prepareContainer(container);
>>>
>>> LifecycleUtil.activate(container);
>>>
>>>
>>> CDOUtil.prepareContainer(container); // Register CDO factories
>>>
>>>
>>> // Create connector
>>>
>>> IConnector conn = TCPUtil.getConnector(container, "localhost:2036");
>>>
>>>
>>> boolean connected = conn.connect(-1);
>>>
>>>
>>> Adomas Greicius
>>>
>>>
>>>
>
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.03375 seconds