本文整理汇总了Java中java.security.AccessController.doPrivilegedWithCombiner方法的典型用法代码示例。如果您正苦于以下问题:Java AccessController.doPrivilegedWithCombiner方法的具体用法?Java AccessController.doPrivilegedWithCombiner怎么用?Java AccessController.doPrivilegedWithCombiner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.AccessController
的用法示例。
在下文中一共展示了AccessController.doPrivilegedWithCombiner方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: plainConnect
import java.security.AccessController; //导入方法依赖的package包/类
protected void plainConnect() throws IOException {
synchronized (this) {
if (connected) {
return;
}
}
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<Void>() {
public Void run() throws IOException {
plainConnect0();
return null;
}
}, null, p
);
} catch (PrivilegedActionException e) {
throw (IOException) e.getException();
}
} else {
// run without additional permission
plainConnect0();
}
}
示例2: getOutputStream
import java.security.AccessController; //导入方法依赖的package包/类
@Override
public synchronized OutputStream getOutputStream() throws IOException {
connecting = true;
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<OutputStream>() {
public OutputStream run() throws IOException {
return getOutputStream0();
}
}, null, p
);
} catch (PrivilegedActionException e) {
throw (IOException) e.getException();
}
} else {
return getOutputStream0();
}
}
示例3: getInputStream
import java.security.AccessController; //导入方法依赖的package包/类
@Override
public synchronized InputStream getInputStream() throws IOException {
connecting = true;
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<InputStream>() {
public InputStream run() throws IOException {
return getInputStream0();
}
}, null, p
);
} catch (PrivilegedActionException e) {
throw (IOException) e.getException();
}
} else {
return getInputStream0();
}
}
示例4: plainConnect
import java.security.AccessController; //导入方法依赖的package包/类
protected void plainConnect() throws IOException {
synchronized (this) {
if (connected) {
return;
}
}
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<>() {
public Void run() throws IOException {
plainConnect0();
return null;
}
}, null, p
);
} catch (PrivilegedActionException e) {
throw (IOException) e.getException();
}
} else {
// run without additional permission
plainConnect0();
}
}
示例5: getOutputStream
import java.security.AccessController; //导入方法依赖的package包/类
@Override
public synchronized OutputStream getOutputStream() throws IOException {
connecting = true;
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<>() {
public OutputStream run() throws IOException {
return getOutputStream0();
}
}, null, p
);
} catch (PrivilegedActionException e) {
throw (IOException) e.getException();
}
} else {
return getOutputStream0();
}
}
示例6: getInputStream
import java.security.AccessController; //导入方法依赖的package包/类
@Override
public synchronized InputStream getInputStream() throws IOException {
connecting = true;
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<>() {
public InputStream run() throws IOException {
return getInputStream0();
}
}, null, p
);
} catch (PrivilegedActionException e) {
throw (IOException) e.getException();
}
} else {
return getInputStream0();
}
}
示例7: test3
import java.security.AccessController; //导入方法依赖的package包/类
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
AccessController.doPrivilegedWithCombiner(
(PrivilegedAction<Void>) () -> null, acc, null);
}
示例8: test4
import java.security.AccessController; //导入方法依赖的package包/类
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
AccessController.doPrivilegedWithCombiner(
(PrivilegedAction<Void>) () -> null, acc, p1, null);
}
示例9: test7
import java.security.AccessController; //导入方法依赖的package包/类
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
AccessController.doPrivilegedWithCombiner(
(PrivilegedExceptionAction<Void>) () -> null,
acc, null);
}
示例10: test8
import java.security.AccessController; //导入方法依赖的package包/类
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
AccessController.doPrivilegedWithCombiner(
(PrivilegedExceptionAction<Void>) () -> null,
acc, p1, null);
}