Thursday 15 August 2013

publish subscribe - Creating method dependency in java -



publish subscribe - Creating method dependency in java -

i have 2 methods names sendsdata() , sendcdata() in myclass.

class myclass { public void sendsdata() { // receiving response database } public void sendcdata() { // send c info } }

i'm calling these 2 method main method

public static void main(string ... args) { myclass obj=new myclass(); obj.sendsdata(); obj.sendcdata(); }

it possible me send sendcdata request after if , if got success response sendsdata() method.

how can accomplish in java?

senddata() publishing info server . if success response server possible me send sendcdata(). i'm usung pub/sub model. i'm not calling web service or rest service. receiving respose have separate subscriber

public boolean sendsdata() { // handle whether or not function returns true or false homecoming true; } public static void main(string ... args) { myclass obj=new myclass(); if (obj.sendsdata()) { obj.sendcdata(); } else { // obj.sendsdata() did not respond } }

with above code obj.sendcdata() run if sendsdata() returns true (successfully responded).

java publish-subscribe

No comments:

Post a Comment