Changeset 7376


Ignore:
Timestamp:
12/09/10 13:22:54 (9 years ago)
Author:
aivar
Message:

Added a single-instance implementation option. This uses the multi-instance code but throttles plugin class instance creation so that only one instance is active at a time for a given plugin class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/maven/projects/deep-zoom-plugin/src/main/java/loci/deepzoomplugin/DeepZoom.java

    r7363 r7376  
    5454    private static final String LAUNCH = "LAUNCH"; 
    5555    private static final String URL = "URL"; 
    56     private enum Implementation { CHAINED, MULTITHREADED, MULTIINSTANCE }; 
    57     private static final String[] m_choices = { Implementation.CHAINED.name(), Implementation.MULTITHREADED.name(), Implementation.MULTIINSTANCE.name() }; 
     56    private enum Implementation { CHAINED, MULTITHREADED, SINGLEINSTANCE, MULTIINSTANCE }; 
     57    private static final String[] m_choices = { 
     58            Implementation.CHAINED.name(), 
     59            //Implementation.MULTITHREADED.name(), 
     60            Implementation.SINGLEINSTANCE.name(), 
     61            Implementation.MULTIINSTANCE.name() 
     62        }; 
    5863    private Preferences m_prefs = Preferences.userRoot().node(this.getClass().getName()); 
    5964 
     
    108113        switch (implementation) { 
    109114            case CHAINED: 
    110             case MULTITHREADED: 
     115            case MULTITHREADED: //TODO 
    111116                loci.chainableplugin.deepzoom.DeepZoomExporter 
    112117                        deepZoomExporter1 = new loci.chainableplugin.deepzoom.DeepZoomExporter 
     
    115120                deepZoomExporter1.process(imageWrapper1); 
    116121                break; 
    117             case MULTIINSTANCE: 
     122            case SINGLEINSTANCE: 
     123                loci.multiinstanceplugin.PluginLauncher.s_singleInstance = true; 
    118124                loci.multiinstanceplugin.deepzoom.DeepZoomExporter 
    119125                        deepZoomExporter2 = new loci.multiinstanceplugin.deepzoom.DeepZoomExporter 
     
    121127                loci.plugin.ImageWrapper imageWrapper2 = new loci.plugin.ImageWrapper(ip); 
    122128                deepZoomExporter2.process(imageWrapper2); 
     129                break; 
     130            case MULTIINSTANCE: 
     131                loci.multiinstanceplugin.PluginLauncher.s_singleInstance = false; 
     132                loci.multiinstanceplugin.deepzoom.DeepZoomExporter 
     133                        deepZoomExporter3 = new loci.multiinstanceplugin.deepzoom.DeepZoomExporter 
     134                                (launch, false, folder, url, name, description, width, height); 
     135                loci.plugin.ImageWrapper imageWrapper3 = new loci.plugin.ImageWrapper(ip); 
     136                deepZoomExporter3.process(imageWrapper3); 
    123137                break; 
    124138        } 
Note: See TracChangeset for help on using the changeset viewer.