Acknowledgment

Foxtrot

The Spin project is influenced by the Foxtrot project. Foxtrot is the inventor of the Synchronous Model (Spin has adopted this technique) but uses an API that is similar to SwingWorker. It offers a subset of Spins features - it lacks transparent exception handling and offers no solution for asynchronous callbacks:

GUI.java

public void actionPerformed(ActionEvent e)

{

 
label.setText("...");

  String text =
(String)Worker.post(new Job()

  {

   
public Object run()

    {

     
return bean.getValue();

   
}

  })
;

  label.setText
(text);

}

The following code shows how Foxtrot can be 'simulated' with Spin (if you insist on restricting yourself to only one generic interface named Job or what-ever-you-like):

GUI.java

public void actionPerformed(ActionEvent e)

{

 
label.setText("...");

  String text =
((Job)Spin.off(new Job()

  {

   
public String run()

    {

     
return bean.getValue();

   
}

  }))
.run();

  label.setText
(text);

}

CGLib

Starting with release 1.4 Spin isn't any longer restricted on using JDK virtual proxies. The creation of proxies is now encapsulated in the interface ProxyFactory.

Spin contains a CGLib specific implementation CGLibProxyFactory that offers the following benefits:

  • improved performance on interception of method invocations
  • no need to to use interfaces for your beans as required by JDK proxies
For this you just have to change the default factory of proxies:
Spin.setDefaultProxyFactory(new CGLibProxyFactory());