下面列出了javax.net.ssl.SSLSessionBindingListener#javax.net.ssl.SSLSessionBindingEvent 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void putValue(String name, Object value) {
if (name == null) {
throw new IllegalArgumentException(sm.getString("engine.nullName"));
}
if (value == null) {
throw new IllegalArgumentException(sm.getString("engine.nullValue"));
}
Map<String, Object> values = this.values;
if (values == null) {
// Use size of 2 to keep the memory overhead small
values = this.values = new HashMap<>(2);
}
Object old = values.put(name, value);
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueBound(new SSLSessionBindingEvent(this, name));
}
notifyUnbound(old, name);
}
@Override
public void putValue(String name, Object value) {
if (name == null) {
throw new NullPointerException("name");
}
if (value == null) {
throw new NullPointerException("value");
}
Map<String, Object> values = this.values;
if (values == null) {
// Use size of 2 to keep the memory overhead small
values = this.values = new HashMap<String, Object>(2);
}
Object old = values.put(name, value);
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueBound(new SSLSessionBindingEvent(this, name));
}
notifyUnbound(old, name);
}
@Override
public synchronized void putValue(String name, Object value) {
if (name == null) {
throw new IllegalArgumentException(Messages.MESSAGES.nameWasNull());
}
if (value == null) {
throw new IllegalArgumentException(Messages.MESSAGES.valueWasNull());
}
Map<String, Object> values = this.values;
if (values == null) {
// Use size of 2 to keep the memory overhead small
values = this.values = new HashMap<>(2);
}
Object old = values.put(name, value);
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueBound(new SSLSessionBindingEvent(this, name));
}
notifyUnbound(old, name);
}
@Override
public void putValue(String name, Object value) {
ObjectUtil.checkNotNull(name, "name");
ObjectUtil.checkNotNull(value, "value");
Map<String, Object> values = this.values;
if (values == null) {
// Use size of 2 to keep the memory overhead small
values = this.values = new HashMap<String, Object>(2);
}
Object old = values.put(name, value);
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueBound(new SSLSessionBindingEvent(this, name));
}
notifyUnbound(old, name);
}
public void putValue(String s, Object obj) {
if(s == null || obj == null)
throw new IllegalArgumentException("arguments can not be null");
Object obj1 = table.put(s, obj);
if(obj1 instanceof SSLSessionBindingListener) {
SSLSessionBindingEvent sslsessionbindingevent = new SSLSessionBindingEvent(this, s);
((SSLSessionBindingListener)obj1).valueUnbound(sslsessionbindingevent);
}
if(obj instanceof SSLSessionBindingListener) {
SSLSessionBindingEvent sslsessionbindingevent1 = new SSLSessionBindingEvent(this, s);
((SSLSessionBindingListener)obj).valueBound(sslsessionbindingevent1);
}
}
public void removeValue(String s) {
if(s == null)
throw new IllegalArgumentException("argument can not be null");
Object obj = table.remove(s);
if(obj instanceof SSLSessionBindingListener) {
SSLSessionBindingEvent sslsessionbindingevent = new SSLSessionBindingEvent(this, s);
((SSLSessionBindingListener)obj).valueUnbound(sslsessionbindingevent);
}
}
private void notifyUnbound(Object value, String name) {
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueUnbound(new SSLSessionBindingEvent(this, name));
}
}
private void notifyUnbound(Object value, String name) {
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueUnbound(new SSLSessionBindingEvent(this, name));
}
}
@Override
public void valueBound(SSLSessionBindingEvent event) {
System.out.printf(" valueBound: %s%n", event.getName());
}
@Override
public void valueUnbound(SSLSessionBindingEvent event) {
System.out.printf(" valueUnbound: %s%n", event.getName());
unboundNotified++;
}
private void notifyUnbound(Object value, String name) {
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueUnbound(new SSLSessionBindingEvent(this, name));
}
}
private void notifyUnbound(Object value, String name) {
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener) value).valueUnbound(new SSLSessionBindingEvent(this, name));
}
}
/**
* javax.net.ssl.SSLSessionBindingEvent#getSession()
*/
public void test_getSession() {
SSLSession ses = new MySSLSession();
SSLSessionBindingEvent event = new SSLSessionBindingEvent(ses, "test");
assertEquals("Incorrect session", ses, event.getSession());
}