Examples of RWLock


Examples of com.lightcrafts.media.jai.util.RWLock

    public ThreadSafeOperationRegistry() {
  super();

  // Create an upgradable reader/writer lock.
  lock = new RWLock(true);
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    private void addObjectToDB(EmptyPreset ep, Integer index) {
        finalizeAddObjectToDB(ep, index);
    }

    private void finalizeAddObjectToDB(Object p, Integer index) {
        p2pl.put(index, new RWLock());
        p2pobj.put(index, p);
        addIndexToContext(index, rootPresetContext);
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    public void lockPresetRead(PresetContext pc, Integer preset) throws NoSuchPresetException, NoSuchContextException {
        if (pc == null)
            throw new NoSuchContextException();

        RWLock pLock = (RWLock) p2pl.get(preset);

        if (pLock != null)
            pLock.read();
        else
            throw new NoSuchPresetException(preset);
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    public boolean tryLockPresetRead(PresetContext pc, Integer preset) throws NoSuchPresetException, NoSuchContextException {
        if (pc == null)
            throw new NoSuchContextException();

        RWLock pLock = (RWLock) p2pl.get(preset);
        if (pLock != null) {
            return pLock.tryRead();
        } else
            throw new NoSuchPresetException(preset);
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

            throw new NoSuchContextException();

        if (p2pc.get(preset) != pc)
            lockPresetWrite(getParent(pc), preset);
        else {
            RWLock pLock = (RWLock) p2pl.get(preset);
            if (pLock != null)
                pLock.write();
            else
                throw new NoSuchPresetException(preset);
        }
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

            throw new NoSuchContextException();

        if (p2pc.get(preset) != pc)
            return tryLockPresetWrite(getParent(pc), preset);
        else {
            RWLock pLock = (RWLock) p2pl.get(preset);
            if (pLock != null) {
                return pLock.tryWrite();
            } else
                throw new NoSuchPresetException(preset);
        }
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    public boolean isPresetWriteLocked(PresetContext pc, Integer preset) throws NoSuchPresetException, NoSuchContextException {
        if (p2pc.get(preset) != pc || pc == null)
            throw new NoSuchContextException();

        RWLock pLock = (RWLock) p2pl.get(preset);
        if (pLock == null)
            throw new NoSuchPresetException(preset);
        return pLock.isWriteLocked();
    }
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

        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();
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    }

    private String initializeSampleData(int index) {
        device.access();
        Integer sample;
        RWLock sLock;
        Object sobj;
        try {
            sample = IntPool.get(index);
            sLock = ((RWLock) s2sl.get(sample));
            sLock.write();
            try {
                sobj = s2sobj.get(sample);
                if (sobj != null && sobj instanceof UninitSampleObject) {
                    sobj = scf.initializeSampleAtIndex(sample, se_handler);
                    if (sobj != null) {
                        s2sobj.put(sample, sobj);
                        se_handler.postSampleEvent(new SampleInitializeEvent(this, sample));
                        return sobj.toString();
                    }
                }
            } finally {
                sLock.unlock();
            }
        } finally {
            device.unlock();
        }
        return null;
View Full Code Here

Examples of com.pcmsolutions.util.RWLock

    private void addObjectToDB(EmptySample es, Integer index) {
        finalizeAddObjectToDB(es, index);
    }

    private void finalizeAddObjectToDB(Object s, Integer index) {
        s2sl.put(index, new RWLock());
        s2sobj.put(index, s);
        addIndexToContext(index, rootSampleContext);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.