/**
* Copyright 2011-2013 Universite Joseph Fourier, LIG, ADELE team
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* CallbackLoop.java - 19 août 2013
*/
package fr.imag.adele.apam.pax.test.eldritch.lock;
/**
* This one cause an infinite loop between two callbacks sets on fields ApAM calls
* It stacks method calls until Stack overflow that is silently catched by ApAM
*
* @author thibaud
*
*/
public class CallbackLoop {
private int a;
private int b;
public CallbackLoop() {
a=0;
b=0;
}
public void aChanged() {
if (b >= 0 && b < 100)
b = a + 1;
else
b = 0;
}
public void bChanged() {
if (a >= 0 && a < 100)
a = b + 1;
else
a = 0;
}
}