Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO connetion
CDO connetion [message #424445] Mon, 27 October 2008 13:44 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
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 #424480 is a reply to message #424446] Tue, 28 October 2008 07:35 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
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
>>>
>>>
>>>
>
>
>


Re: CDO connetion [message #424483 is a reply to message #424480] Tue, 28 October 2008 07:52 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
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
>>>
>>>
>>>
>
>
>


Previous Topic:CDO Audit Store deltas instead of the whole objects
Next Topic:installing emf under eclipse 3.4.1 on linux
Goto Forum:
  


Current Time: Fri Apr 26 06:17:42 GMT 2024

Powered by FUDForum. Page generated in 0.03375 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top