public class BackgroundFloobleLoader { public volatile Flooble theFlooble; public void initInBackground() { // do lots of stuff theFlooble = new Flooble(); // this is the only write to theFlooble } } public class SomeOtherClass { public void doWork(){ while (true) { // do some stuff... // use the Flooble, but only if it is ready if (floobleLoader.theFlooble != null) doSomething(floobleLoader.theFlooble); } } } } }
// String to show the location this subscriber is listening to. private String location; // The application class. We need this so we can insert any events we create
private LogisticsApp app; /**JMS Destination to send messages to*/ private volatile Destination destination; /**JMS Template to use to send messages*/ private volatile JmsTemplate template; public void setDestination(Destination destination) { this.destination = destination; }