/**
* @param bcsae the BeanContextServiceAvailableEvent
*/
public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) {
// Get a reference to the context
BeanContextServices context = bcsae.getSourceAsBeanContextServices();
// Use the service, if it's available
if (context.hasService(TestCounter.class)) {
// System.out.println("Attempting to use the service...");
try {
// Got the service
service = (TestCounter) context.getService(this,
this, TestCounter.class, str, this);
service.counter();
} catch (Exception e) {
}
this.bcsae = bcsae;
}
}
java类java.beans.beancontext.BeanContextServices的实例源码
ServiceBean.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
Test4328406.java 文件源码
项目:jdk8u-jdk
阅读 20
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:openjdk-jdk10
阅读 17
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:openjdk9
阅读 25
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:jdk8u_jdk
阅读 23
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 41
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:infobip-open-jdk-8
阅读 29
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:jdk8u-dev-jdk
阅读 23
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:jdk7-jdk
阅读 22
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:openjdk-source-code-learn
阅读 26
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:OLD-OpenJDK8
阅读 21
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
BeanContextServiceRevokedEventTest.java 文件源码
项目:cn1
阅读 22
收藏 0
点赞 0
评论 0
public void testBeanContextServiceRevokedEvent() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertSame(BeanContext.class, event.getServiceClass());
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
assertTrue(event.isCurrentServiceInvalidNow());
}
BeanContextServiceRevokedEventTest.java 文件源码
项目:cn1
阅读 25
收藏 0
点赞 0
评论 0
public void testIsServiceClass() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertTrue(event.isServiceClass(BeanContext.class));
assertFalse(event.isServiceClass(Integer.class));
// Regression for HARMONY-1516
assertFalse(event.isServiceClass(null));
}
BeanContextServiceRevokedEventTest.java 文件源码
项目:cn1
阅读 16
收藏 0
点赞 0
评论 0
public void testIsCurrentServiceInvalidNow() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertTrue(event.isCurrentServiceInvalidNow());
event = new MockBeanContextServiceRevokedEvent(services,
BeanContext.class, false);
assertFalse(event.isCurrentServiceInvalidNow());
}
BeanContextServiceRevokedEventTest.java 文件源码
项目:cn1
阅读 34
收藏 0
点赞 0
评论 0
public void testConstructor() throws Exception {
BeanContextServices bcs = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
bcs, ArrayList.class, true);
assertEquals(null, event.getPropagatedFrom());
assertEquals(ArrayList.class, event.getServiceClass());
assertSame(bcs, event.getSource());
assertSame(bcs, event.getBeanContext());
assertSame(bcs, event.getSourceAsBeanContextServices());
assertFalse(event.isPropagated());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:cn1
阅读 21
收藏 0
点赞 0
评论 0
public void testBeanContextServiceAvailableEvent_NullParam() {
BeanContextServices services = new MockBeanContextServices();
try {
new MockBeanContextServiceAvailableEvent(null, BeanContext.class);
fail("IAE expected");
} catch (IllegalArgumentException e) {
// expected
}
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, null);
assertNull(event.getServiceClass());
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:cn1
阅读 28
收藏 0
点赞 0
评论 0
public void testBeanContextServiceAvailableEvent() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, BeanContext.class);
assertSame(BeanContext.class, event.getServiceClass());
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:cn1
阅读 25
收藏 0
点赞 0
评论 0
public void testGetSourceAsBeanContextServices() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, BeanContext.class);
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:cn1
阅读 24
收藏 0
点赞 0
评论 0
public void testGetCurrentServiceSelectors() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, BeanContext.class);
Iterator expectedIt = services
.getCurrentServiceSelectors(BeanContext.class);
Iterator it = event.getCurrentServiceSelectors();
while (expectedIt.hasNext()) {
assertSame(expectedIt.next(), it.next());
}
assertFalse(expectedIt.hasNext());
assertFalse(it.hasNext());
}
MockBeanContextServiceProvider.java 文件源码
项目:cn1
阅读 98
收藏 0
点赞 0
评论 0
public Object getService(BeanContextServices bcs, Object requestor,
Class serviceClass, Object serviceSelector) {
Object result = Collections.EMPTY_SET;
records.add("getService", bcs, requestor, serviceClass,
serviceSelector, result);
return result;
}
Test4328406.java 文件源码
项目:JAVA_UNIT
阅读 22
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:openjdk-jdk7u-jdk
阅读 27
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
BeanContextServiceRevokedEventTest.java 文件源码
项目:freeVM
阅读 26
收藏 0
点赞 0
评论 0
public void testBeanContextServiceRevokedEvent() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertSame(BeanContext.class, event.getServiceClass());
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
assertTrue(event.isCurrentServiceInvalidNow());
}
BeanContextServiceRevokedEventTest.java 文件源码
项目:freeVM
阅读 20
收藏 0
点赞 0
评论 0
public void testIsServiceClass() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertTrue(event.isServiceClass(BeanContext.class));
assertFalse(event.isServiceClass(Integer.class));
// Regression for HARMONY-1516
assertFalse(event.isServiceClass(null));
}
BeanContextServiceRevokedEventTest.java 文件源码
项目:freeVM
阅读 22
收藏 0
点赞 0
评论 0
public void testIsCurrentServiceInvalidNow() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertTrue(event.isCurrentServiceInvalidNow());
event = new MockBeanContextServiceRevokedEvent(services,
BeanContext.class, false);
assertFalse(event.isCurrentServiceInvalidNow());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:freeVM
阅读 26
收藏 0
点赞 0
评论 0
public void testBeanContextServiceAvailableEvent_NullParam() {
BeanContextServices services = new MockBeanContextServices();
try {
new MockBeanContextServiceAvailableEvent(null, BeanContext.class);
fail("IAE expected");
} catch (IllegalArgumentException e) {
// expected
}
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, null);
assertNull(event.getServiceClass());
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:freeVM
阅读 27
收藏 0
点赞 0
评论 0
public void testBeanContextServiceAvailableEvent() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, BeanContext.class);
assertSame(BeanContext.class, event.getServiceClass());
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:freeVM
阅读 27
收藏 0
点赞 0
评论 0
public void testGetSourceAsBeanContextServices() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, BeanContext.class);
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
}
BeanContextServiceAvailableEventTest.java 文件源码
项目:freeVM
阅读 28
收藏 0
点赞 0
评论 0
public void testGetCurrentServiceSelectors() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
services, BeanContext.class);
Iterator expectedIt = services
.getCurrentServiceSelectors(BeanContext.class);
Iterator it = event.getCurrentServiceSelectors();
while (expectedIt.hasNext()) {
assertSame(expectedIt.next(), it.next());
}
assertFalse(expectedIt.hasNext());
assertFalse(it.hasNext());
}
MockBeanContextServiceProvider.java 文件源码
项目:freeVM
阅读 26
收藏 0
点赞 0
评论 0
public Object getService(BeanContextServices bcs, Object requestor,
Class serviceClass, Object serviceSelector) {
Object result = Collections.EMPTY_SET;
records.add("getService", bcs, requestor, serviceClass,
serviceSelector, result);
return result;
}