當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessController.doPrivilegedWithCombiner方法代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:26,代碼來源:HttpURLConnection.java

示例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();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:22,代碼來源:HttpURLConnection.java

示例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();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:22,代碼來源:HttpURLConnection.java

示例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();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:HttpURLConnection.java

示例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();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:HttpURLConnection.java

示例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();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:HttpURLConnection.java

示例7: test3

import java.security.AccessController; //導入方法依賴的package包/類
@Test(expectedExceptions = NullPointerException.class)
public void test3() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, null);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:LimitedDoPrivilegedWithNullPerms.java

示例8: test4

import java.security.AccessController; //導入方法依賴的package包/類
@Test(expectedExceptions = NullPointerException.class)
public void test4() {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedAction<Void>) () -> null, acc, p1, null);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:LimitedDoPrivilegedWithNullPerms.java

示例9: test7

import java.security.AccessController; //導入方法依賴的package包/類
@Test(expectedExceptions = NullPointerException.class)
public void test7() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, null);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:7,代碼來源:LimitedDoPrivilegedWithNullPerms.java

示例10: test8

import java.security.AccessController; //導入方法依賴的package包/類
@Test(expectedExceptions = NullPointerException.class)
public void test8() throws PrivilegedActionException {
    AccessController.doPrivilegedWithCombiner(
            (PrivilegedExceptionAction<Void>) () -> null,
            acc, p1, null);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:7,代碼來源:LimitedDoPrivilegedWithNullPerms.java


注:本文中的java.security.AccessController.doPrivilegedWithCombiner方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。