Package com.pcmsolutions.system.threads

Examples of com.pcmsolutions.system.threads.ZWaitThread


        }
    }

    public Thread[] stopWorkerThreads() {
        deviceLock.configure();
        ZWaitThread t;
        try {
            synchronized (workerThreads) {
                Vector wt_clone = (Vector) workerThreads.clone();
                int size = workerThreads.size();
                for (int n = 0; n < size; n++) {
                    t = (ZWaitThread) workerThreads.get(n);
                    t.stopThread();
                }
                workerThreads.clear();
                return (Thread[]) wt_clone.toArray(new Thread[wt_clone.size()]);
            }
        } finally {
View Full Code Here


    // assumes that all indexes are valid!
    private void initializeSpecifiedPresetNames(final int[] indexes, final boolean chainToData) {
        // if (true)
        //   return;
        ZWaitThread t = new ZBackgroundRemoterThread() {
            public void run() {
                this.setName("PresetNamePass");
                Integer preset;
                for (int n = 0, o = indexes.length; n < o; n++) {
                    deviceLock.access();
                    try {
                        if (this.alive == false)
                            return;
                        preset = IntPool.get(indexes[n]);
                        assertPresetNamed(rootPresetContext, preset);
                    } catch (NoSuchPresetException e) {
                    } catch (NoSuchContextException e) {
                    } finally {
                        deviceLock.unlock();
                    }
                }
                if (chainToData)
                    initializeSpecifiedPresetData(indexes);
            }
        };
        workerThreads.add(t);
        t.start();
    }
View Full Code Here

        initializeSpecifiedPresetData(indexes);
    }

    // assumes that all indexes are valid!
    private void initializeSpecifiedPresetData(final int[] indexes) {
        ZWaitThread t = new ZRemoteDumpThread() {
            public void run() {
                this.setName("PresetDataPass");
                Integer preset;
                for (int n = 0, o = indexes.length; n < o; n++) {
                    deviceLock.access();
                    try {
                        if (this.alive == false) {
                            return;
                        }
                        preset = IntPool.get(indexes[n]);
                        try {
                            if (!isPresetInitialized(preset))
                                refreshPreset(rootPresetContext, preset);
                        } catch (NoSuchPresetException e) {
                        } catch (NoSuchContextException e) {
                        }
                    } finally {
                        deviceLock.unlock();
                    }
                }
            }
        };
        workerThreads.add(t);
        t.start();
    }
View Full Code Here

        }
    }

    public Thread[] stopWorkerThreads() {
        device.configure();
        ZWaitThread t;
        try {
            synchronized (workerThreads) {
                Vector wt_clone = (Vector) workerThreads.clone();
                int size = workerThreads.size();
                for (int n = 0; n < size; n++) {
                    t = (ZWaitThread) workerThreads.get(n);
                    t.stopThread();
                }
                workerThreads.clear();
                return (Thread[]) wt_clone.toArray(new Thread[wt_clone.size()]);
            }
        } finally {
View Full Code Here

    }

    private void initializeSpecifiedSampleData(final int[] indexes, final SampleRomNameProvisionMediator cb) {
        //if (true)
        //  return;
        ZWaitThread t = new ZBackgroundRemoterThread() {
            public void run() {
                try {
                    this.setName("SampleDataPass");
                    Integer sample;
                    RWLock sLock;
                    Object sobj;
                    for (int n = 0, o = indexes.length; n < o; n++) {
                        device.access();
                        try {
                            if (this.alive == false) {
                                return;
                            }
                            sample = IntPool.get(indexes[n]);
                            sLock = ((RWLock) s2sl.get(sample));
                            sLock.write();
                            try {
                                sobj = s2sobj.get(sample);
                                if (sobj != null && sobj instanceof UninitSampleObject) {
                                    if (cb != null && cb.providesNames())
                                        sobj = scf.initializeSampleAtIndex(sample, cb.getName(sample.intValue()), se_handler);
                                    else
                                        sobj = scf.initializeSampleAtIndex(sample, se_handler);
                                    if (sobj == null)
                                        continue;
                                    s2sobj.put(sample, sobj);
                                    se_handler.postSampleEvent(new SampleInitializeEvent(this, sample));
                                }
                                if (cb != null && sobj != null && cb.wantsNames())
                                    cb.setName(sample.intValue(), sobj.toString());
                            } finally {
                                sLock.unlock();
                            }
                        } finally {
                            device.unlock();
                        }
                        // yield();
                    }
                } finally {
                    if (cb != null)
                        cb.done();
                }
            }
        };
        workerThreads.add(t);
        t.start();
    }
View Full Code Here

TOP

Related Classes of com.pcmsolutions.system.threads.ZWaitThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.