本文整理匯總了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);
}