java - How to pass BlockingQueue? -


there 2 classes. one, x , has it's own blockingqueue , method returning it:

public int getqueue(){     return taskqueue; } 

but seems returns queue's reference. , need operate on in other class y there x.getqueue().take(); . there way pass queue getters / setters ?

public int getqueue() {     return taskqueue; } 

you trying returning taskqueue class int , not taskqueue object.

i don't know how's code structure, here example of want do:

class x {     private blockingqueue taskqueue;      public x()     {         taskqueue = new blockingqueue();     }      public blockingqueue getqueue()     {         return taskqueue;     } } 

and can use in other class:

x myxclassobject = new x();  myxclassobject.getqueue().blockingqueuemethod(); 

or in more understandable way:

x myxclassobject = new x();  blockingqueue myqueue = myxclassobject.getqueue();  myqueue.blockingqueuemethod(); myqueue.take(); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -