本文整理汇总了Java中javax.security.auth.Destroyable类的典型用法代码示例。如果您正苦于以下问题:Java Destroyable类的具体用法?Java Destroyable怎么用?Java Destroyable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Destroyable类属于javax.security.auth包,在下文中一共展示了Destroyable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNoKeyDestruction
import javax.security.auth.Destroyable; //导入依赖的package包/类
private static void testNoKeyDestruction(Destroyable key)
throws Exception {
String klass = key.getClass().getName();
if (key.isDestroyed()) {
throw new Exception("error: a " + klass +
" key has been unexpectedly destroyed");
}
try {
key.destroy();
} catch (DestroyFailedException dfe) {
// not an error
if (key.isDestroyed()) {
throw new Exception("error: a " + klass +
" key has been unexpectedly destroyed");
}
System.out.println(klass + " keys are not destroyable");
return;
}
throw new Exception("error: key may been unexpectedly destroyed");
}
示例2: destroyKey
import javax.security.auth.Destroyable; //导入依赖的package包/类
private static void destroyKey(Key key) throws Exception {
String klass = key.getClass().getName();
if (!(key instanceof Destroyable)) {
throw new UnsupportedOperationException();
}
Destroyable dKey = (Destroyable) key;
if (dKey.isDestroyed()) {
throw new Exception("error: a " + klass +
" key has already been destroyed");
}
dKey.destroy();
if (!dKey.isDestroyed()) {
throw new Exception("error: a " + klass +
" key has NOT been destroyed");
}
}
示例3: destroy
import javax.security.auth.Destroyable; //导入依赖的package包/类
public void destroy() throws DestroyFailedException
{
if (this.children != null)
{
for (Destroyable destroyable : this.children)
{
if (destroyable.isDestroyed()) continue;
if (destroyable instanceof DestroyableChild)
((DestroyableChild)destroyable).unlink();
destroyable.destroy();
}
this.children = null;
}
super.destroy();
}
示例4: register
import javax.security.auth.Destroyable; //导入依赖的package包/类
public void register(Destroyable destroyable)
{
if (this.children == null)
this.children = new HashSet<Destroyable>();
this.children.add(destroyable);
}
示例5: destroy
import javax.security.auth.Destroyable; //导入依赖的package包/类
@Override
public void destroy() {
if (key instanceof Destroyable && !((Destroyable) key).isDestroyed()) {
try {
((Destroyable) key).destroy();
} catch (DestroyFailedException e) {
// it's too common that JCE keys aren't destroyable although they say they are
// so won't log this to avoid spamming logs
}
}
}
示例6: deregister
import javax.security.auth.Destroyable; //导入依赖的package包/类
public void deregister(Destroyable destroyable)
{
if (this.children == null) return;
this.children.remove(destroyable);
}
示例7: register
import javax.security.auth.Destroyable; //导入依赖的package包/类
public void register(Destroyable destroyable)
{
this.destroyableHolder.register(destroyable);
}
示例8: deregister
import javax.security.auth.Destroyable; //导入依赖的package包/类
public void deregister(Destroyable destroyable)
{
this.destroyableHolder.deregister(destroyable);
}
示例9: register
import javax.security.auth.Destroyable; //导入依赖的package包/类
/**
* Register a Destroyable for recursive destruction.
*
* @param destroyable The child to be registered.
*/
public void register(Destroyable destroyable);
示例10: deregister
import javax.security.auth.Destroyable; //导入依赖的package包/类
/**
* Deregister a Destroyable from recursive destruction.
*
* @param destroyable The child to be deregistered.
*/
public void deregister(Destroyable destroyable);