Package org.jdesktop.wonderland.client.utils

Examples of org.jdesktop.wonderland.client.utils.SmallIntegerAllocator


     *
     * @param appName The name of the app.
     * @return A number which is unique among apps with the same name.
     */
    private static int allocAppInstance(String appName) {
        SmallIntegerAllocator allocator = instanceAllocators.get(appName);
        if (allocator == null) {
            // First time allocation for app name
            allocator = new SmallIntegerAllocator(1);
            instanceAllocators.put(appName, allocator);
        }
        return allocator.allocate();
    }
View Full Code Here


     *
     * @param appName The name of the app.
     * @param appInstance An app instance previous allocated by allocAppInstance.
     */
    private static void deallocAppInstance(String appName, int appInstance) {
        SmallIntegerAllocator allocator = instanceAllocators.get(appName);
        if (allocator == null) {
            throw new RuntimeException("Deallocation when app instance is not allocated = " +
                    appInstance);
        }

        allocator.free(appInstance);

        if (allocator.getNumAllocated() == 0) {
            instanceAllocators.remove(appName);
        }
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.client.utils.SmallIntegerAllocator

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.