public interface RoleSensitive
Callable
-like objects to designate the intended recipient of the callable,
to help verify callables are running in JVMs that it is intended to run.
This interface is defined separately from Callable
so that other callable-like interfaces
can reuse this.
RoleChecker
Modifier and Type | Method and Description |
---|---|
void |
checkRoles(RoleChecker checker)
Verifies the roles expected by this callable by invoking
RoleChecker.check(RoleSensitive, Collection)
method (or its variants), to provide an opportunity for RoleChecker to reject this object. |
void checkRoles(RoleChecker checker) throws SecurityException
RoleChecker.check(RoleSensitive, Collection)
method (or its variants), to provide an opportunity for RoleChecker
to reject this object.
Do not implement this method unless you know what you are doing.
If you have a Jenkins Callable
or FileCallable
, use the standard abstract base classes instead,
such as MasterToSlaveCallable
, MasterToSlaveFileCallable
, NotReallyRoleSensitiveCallable
, etc.
See this document for details.
If the method returns normally, the check has passed.
SecurityException
- If there's a mismatch in the expected roles and the actual roles that should prevent
the execution of this callable.AbstractMethodError
- In the history of this library, this interface was added rather later, so there's lots of
Callable
s out there that do not implement this method.
For this reason, code that calls this method should be prepared to
receive AbstractMethodError
, and treat that as if the invocation of
checker.check(this,Role.UNKNOWN)
has happened.Copyright © 2004–2022. All rights reserved.