Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

0

Application Implementation

asked 2016-05-20 08:04:33 -0700

monicarajasekaran gravatar image

Hi,

When I start karaf, why is it that the implementation I have written for my application only gets called sometimes and not always?

I even tried starting karaf clean.

Note: “myapp/impl/src/main/java/org/opendaylight/myapp/impl/MyAppProvider.java” has the implementation written under “onSessionInitiated()”

Or is session initiated only once and I have to write my implementation under “MyAppImpl.java” which implements “MyAppService” ??

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2016-05-23 21:36:39 -0700

karthik330 gravatar image

May i know what implementation are you trying? I believe session initiated gets executed only once . If you want to call your function whenever you need ,you have to implement it as RPC implementation unless it is listener function.

edit flag offensive delete publish link more

Comments

Hi Karthik, do you mean I should create a new service? I do have a separate service for my application that has been added to Rpc implementation. But If I want to invoke some function every time the application is started, how do i do that?

monicarajasekaran ( 2016-05-24 07:17:59 -0700 )edit

U could see impl/src/main/java/(org.*.*)/(yourProjectname)module.java->createInstance() function. This function executes first whenever you launch your application.So No matter which class is having ur function-implemetation.Create object of that class inside createInstance() and call your function

karthik330 ( 2016-05-24 21:26:15 -0700 )edit

Hi Karthik, Thanks for that useful info! Do you know how I should get the ProviderContext's session object that was created in onSessionInitiated in my createInstance ? Is there a function to get the current session?

monicarajasekaran ( 2016-05-26 08:29:07 -0700 )edit
Login/Signup to Answer

Stats

Asked: 2016-05-20 08:04:33 -0700

Seen: 46 times

Last updated: May 23 '16