cancel
Showing results for 
Search instead for 
Did you mean: 

To Close the JCo connection

Former Member
0 Kudos

Dear All

I have a scenario. In that I am using 4 Views. And I have 3 separate models. I want to close the Connection explicitly when I go back from 4th View to 1st View.

The control flow is like this

V1-->V2-->V3->V4---V1. and it continues.

How can I acheive this? I want to close all the Connections before going again to 1st View.

The user may exit from any View. At that time also I want to Close.

Where should I write the close connection coding?

	 <ModelName> search=(<ModelName>)WDModelFactory.getModelInstance(<ModelName>.class);
	 search.disconnectIfAlive();

Can anybody help me in this?

Regards

Aparnna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Execute your FNmodule u need to mention the try catch() method.

Simply mention the Connection close method in ..

try{

execute method()

} catch(Exception e)

{

e.printkStrace();

}

finally{

close connection;

}

It might helps u.

Thanks,

Lohi.

Answers (3)

Answers (3)

former_member189631
Active Contributor
0 Kudos

Hi Aparna ,

I suggest You to execute your code for disconnecting RFC connection

in a seperate method. Your code must be enclosed with exception Handling codes.

You can place this method in your component Conroller[Reason: you can call your method from any View ,Incase u may close the connection at any view] and call this method after the Last model execution or in the view4.

Regards,

Ramganesan K.

Former Member
0 Kudos

try this when instance model context...

MDL_Customer_Data_Create model_Customer_Data_Create = (MDL_Customer_Data_Create) WDModelFactory.getModelInstance(MDL_Customer_Data_Create.class, WDModelScopeType.TASK_SCOPE);

model_Customer_Data_Create.disconnectIfAlive();

Z_Hyd_0192_Ep_Input bapIn_Z_Hyd_0192_Ep = (Z_Hyd_0192_Ep_Input) model_Customer_Data_Create.createModelObject(Z_Hyd_0192_Ep_Input.class);

bapIn_Z_Hyd_0192_Ep.setE_Customer_Data(new Zzep_Customer_Data());

wdContext.nodeZ_Hyd_0192_Ep_Input().bind(bapIn_Z_Hyd_0192_Ep);

Former Member
0 Kudos

Hi Aparnna ,

you can write this

<ModelName> search=(<ModelName>)WDModelFactory.getModelInstance(<ModelName>.class);

search.disconnectIfAlive();

after try catch Statements where you execute your model.

or

You can also write...

wdContext.current<ModelName>.modelObject().modelInstance().disconnectIfAlive()

Regards

Sunitha

Former Member
0 Kudos

Hi,

We have wrote the same code after executing the model exactly like you have mentioned above, still we are getting the same error.

<ModelName> search=(<ModelName>)WDModelFactory.getModelInstance(<ModelName>.class);

search.disconnectIfAlive();

Please Provide any other suggestion to solve the error.

Regards

Aparnna

former_member197348
Active Contributor
0 Kudos

Hi Aparna,

No need to close the JCO connections manually, vwhen you create JCo connections you will set connection time in milli seconds. By deafult its value is 10 msec. the connection will be closed , after the time specified.

Regards,

Siva.