当前位置: 首页>>代码示例>>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;未经允许,请勿转载。