/** * Acquire an instance of the TempVar class. * You have to release the instance after use by calling the * release() method. * If more than STACK_SIZE (currently 5) instances are requested * in a single thread then an ArrayIndexOutOfBoundsException will be thrown. * * @return A TempVar instance */ public static TempVars get() { TempVarsStack stack = varsLocal.get(); TempVars instance = stack.tempVars[stack.index]; if (instance == null) { // Create new instance = new TempVars(); // Put it in there stack.tempVars[stack.index] = instance; } stack.index++; instance.isUsed = true; return instance; }
/** * Acquire an instance of the TempVar class. * You have to release the instance after use by calling the * release() method. * If more than STACK_SIZE (currently 5) instances are requested * in a single thread then an ArrayIndexOutOfBoundsException will be thrown. * * @return A TempVar instance */ public static TempVars get() { TempVarsStack stack = varsLocal.get(); TempVars instance = stack.tempVars[stack.index]; if (instance == null) { // Create new instance = new TempVars(); // Put it in there stack.tempVars[stack.index] = instance; } stack.index++; instance.isUsed = true; return instance; }
/** * Acquire an instance of the TempVar class. * You have to release the instance after use by calling the * release() method. * If more than STACK_SIZE (currently 5) instances are requested * in a single thread then an ArrayIndexOutOfBoundsException will be thrown. * * @return A TempVar instance */ public static TempVars get() { TempVarsStack stack = varsLocal.get(); TempVars instance = stack.tempVars[stack.index]; if (instance == null) { // Create new instance = new TempVars(); // Put it in there stack.tempVars[stack.index] = instance; } stack.index++; instance.isUsed = true; return instance; }