本文整理汇总了Java中javax.security.auth.Destroyable.isDestroyed方法的典型用法代码示例。如果您正苦于以下问题:Java Destroyable.isDestroyed方法的具体用法?Java Destroyable.isDestroyed怎么用?Java Destroyable.isDestroyed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.security.auth.Destroyable
的用法示例。
在下文中一共展示了Destroyable.isDestroyed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}