Code example for AccessControlException

0
		} 
 
		IHostedThread robotProxy = threadManager.getLoadedOrLoadingRobotProxy(c);
 
		if (robotProxy == null) {
			throw new AccessControlException("Preventing " + c.getName() + " from access to " + g.getName());			
		} 
 
		if (cg.activeCount() > 5) {
			String message = "Robots are only allowed to create up to 5 threads!";
 
			robotProxy.punishSecurityViolation(message);
			throw new AccessControlException(message);
		} 
	} 
 
	private boolean isSafeThread(Thread c) {
		return threadManager.isSafeThread(c);
	} 
}