[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Query on Issue faced with OpenShift Java Client



Hi Shabna

reading what you experience sounds like a bug or bad usage, we always reuse the very same connection in JBoss Tools (where we use openshift-java-client), we never recreate the connection once it's created.
Especially when removing applications from a domain the domain should reflect the change, it should not report the application that you just removed. We have a unit-test that asserts this:

https://github.com/openshift/openshift-java-client/blob/master/src/test/java/com/openshift/internal/client/ApplicationResourceTest.java#L70

final IApplication app = domain.getApplicationByName("springeap6");
assertThat(app).isNotNull();
app.destroy();
assertThat(domain.getApplications()).hasSize(1).excludes(app);

In the above test we assert #getApplications but #getApplicationByName should be transparent since it operates on the very same collection. I'll push another unit test to assert that #getApplicationByName works correctly.

I suspect that there's some other issue that is causing this weird behavious for you. Can you maybe paste a full example that shows what you experience?

Btw. you can refresh the domain (and all resources: application etc.) and force it to load the state from the backend: IDomain#refresh


On 09/10/2014 08:13 AM, Shabna M wrote:

Hi 

 

I have faced a small issue while using Open Shift Java Client and will appreciate any thoughts on the same:

 

Issue: I have an application that uses Open shift java client to do couple of operation on an application : Following is the code snippet -(not actual code;just indicative)



IOpenShiftConnection connection = getConnection();

IUser user = connection.getUser(); 

IDomain domain = user.createDomain("myDomain");

IApplication application =domain.getApplicationByName(appName);



Now I would not want to do get connection every time and want to login to OS once and use the same connection object for any subsequent operations for performance reasons.

But I saw that while doing the same ,it is not actually reflecting the changes done on the platform.For example if a delete the application from the backend (rhc)

It is not reflected while I do IApplication application =domain.getApplicationByName(appName);

 It needs for me to again get a connection and do all the process.

 

Need to understand if I am missing anything or is there a better workaround to avoid login into PaaS everytime to get the latest changes.

 

 

Any pointers would be really appreciated.Need this to fix a performance bottleneck

 

Thanks

Shabs


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]