Package org.apache.axis2.clustering

Examples of org.apache.axis2.clustering.ClusteringFault


            ContextManager contextManager = clusterManager.getContextManager();
            if (contextManager == null) {
                String msg = "Cannot replicate contexts since " +
                             "ContextManager is not specified in the axis2.xml file.";
                throw new ClusteringFault(msg);
            }

            List contexts = new ArrayList();

            // Do we need to replicate state stored in ConfigurationContext?
            if (!configurationContext.getPropertyDifferences().isEmpty()) {
                contexts.add(configurationContext);
            }

            // Do we need to replicate state stored in ServiceGroupContext?
            ServiceGroupContext sgContext = msgContext.getServiceGroupContext();
            if (sgContext != null && !sgContext.getPropertyDifferences().isEmpty()) {
                contexts.add(sgContext);
            }

            // Do we need to replicate state stored in ServiceContext?
            ServiceContext serviceContext = msgContext.getServiceContext();
            if (serviceContext != null && !serviceContext.getPropertyDifferences().isEmpty()) {
                contexts.add(serviceContext);
            }

            // Do the actual replication here
            if (!contexts.isEmpty()) {
                AbstractContext[] contextArray =
                        (AbstractContext[]) contexts.toArray(new AbstractContext[contexts.size()]);
                String msgUUID = contextManager.updateContexts(contextArray);
                waitForACKs(contextManager, msgUUID, msgContext.getRootContext());
            }

        } else {
            String msg = "Cannot replicate contexts since " +
                         "ClusterManager is not specified in the axis2.xml file.";
            throw new ClusteringFault(msg);
        }
    }
View Full Code Here


                    Thread.sleep(tts.longValue() + 5); // Time to recv ACK + time in queue & processing replication request
                }
            } catch (InterruptedException ignored) {
            }
            if (System.currentTimeMillis() - start > 45000) {
                throw new ClusteringFault("ACKs not received from all members within 45 sec. " +
                                          "Aborting wait.");
            }
        } while (!contextManager.isMessageAcknowledged(msgUUID));
    }
View Full Code Here

                }
            } else {
                String msg =
                        "Trying to replicate non-serializable property " + key +
                        " in context " + context;
                throw new ClusteringFault(msg);
            }
        }
    }
View Full Code Here

                AxisService axisService =
                        configurationContext.getAxisConfiguration().getService(serviceName);
                ServiceContext serviceContext = sgCtx.getServiceContext(axisService);
                propertyUpdater.updateProperties(serviceContext);
            } catch (AxisFault e) {
                throw new ClusteringFault(e);
            }
        } else {
            sgCtx = configurationContext.getServiceGroupContext(serviceGroupContextId);
            AxisService axisService;
            try {
                axisService = configurationContext.getAxisConfiguration().getService(serviceName);
            } catch (AxisFault axisFault) {
                throw new ClusteringFault(axisFault);
            }
            String scope = axisService.getScope();
            if (sgCtx == null) {
                AxisServiceGroup serviceGroup =
                        configurationContext.getAxisConfiguration().getServiceGroup(serviceGroupName);
                if(serviceGroup == null){
                    return;
                }
                sgCtx = new ServiceGroupContext(configurationContext, serviceGroup);
                sgCtx.setId(serviceGroupContextId);
                if (scope.equals(Constants.SCOPE_APPLICATION)) {
                    configurationContext.
                            addServiceGroupContextIntoApplicationScopeTable(sgCtx);
                } else if (scope.equals(Constants.SCOPE_SOAP_SESSION)) {
                    configurationContext.
                            addServiceGroupContextIntoSoapSessionTable(sgCtx);
                }
            }
            try {
                ServiceContext serviceContext = sgCtx.getServiceContext(axisService);
                propertyUpdater.updateProperties(serviceContext);
            } catch (AxisFault axisFault) {
                throw new ClusteringFault(axisFault);
            }
        }
    }
View Full Code Here

                }
            } catch (NotSerializableException e) {
                String message = "Could not send command message " + msg +
                                 " to group since it is not serializable.";
                log.error(message, e);
                throw new ClusteringFault(message, e);
            } catch (ChannelException e) {
                log.error("Could not send message to some members", e);
                ChannelException.FaultyMember[] faultyMembers = e.getFaultyMembers();
                for (ChannelException.FaultyMember faultyMember : faultyMembers) {
                    Member member = faultyMember.getMember();
View Full Code Here

                         Channel.SEND_OPTIONS_USE_ACK);
            if (log.isDebugEnabled()) {
                log.debug("Sent " + msg + " to self");
            }
        } catch (Exception e) {
            throw new ClusteringFault(e);
        }
    }
View Full Code Here

            }
        } catch (NotSerializableException e) {
            String message = "Could not send command message to " + TribesUtil.getName(member) +
                             " since it is not serializable.";
            log.error(message, e);
            throw new ClusteringFault(message, e);
        } catch (ChannelException e) {
            log.error("Could not send message to " + TribesUtil.getName(member));
            ChannelException.FaultyMember[] faultyMembers = e.getFaultyMembers();
            log.error("Member " + TribesUtil.getName(member) + " is faulty",
                      faultyMembers[0].getCause());
View Full Code Here

                break;
            case ConfigurationClusteringCommand.EXCEPTION:
                listener.handleException(((ExceptionCommand) command).getException());
                break;
            default:
                throw new ClusteringFault("Invalid ConfigurationClusteringCommand " +
                                          command.getClass().getName());
        }
    }
View Full Code Here

                try {
                    host = Utils.getIpAddress();
                } catch (SocketException e) {
                    String msg = "Could not get local IP address";
                    log.error(msg, e);
                    throw new ClusteringFault(msg, e);
                }
            } catch (Exception e) {
                String msg = "Could not get the localhost name";
                log.error(msg, e);
                throw new ClusteringFault(msg, e);
            }
        }
        receiver.setAddress(host);
        try {
            localMember.setHostname(host);
        } catch (IOException e) {
            String msg = "Could not set the local member's name";
            log.error(msg, e);
            throw new ClusteringFault(msg, e);
        }

        Parameter localPort = getParameter(TribesConstants.LOCAL_MEMBER_PORT);
        int port;
        try {
            if (localPort != null) {
                port = Integer.parseInt(((String) localPort.getValue()).trim());
                port = getLocalPort(new ServerSocket(), localMember.getHostname(), port, 4000, 100);
            } else { // In cases where the localport needs to be automatically figured out
                port = getLocalPort(new ServerSocket(), localMember.getHostname(), -1, 4000, 100);
            }
        } catch (IOException e) {
            String msg =
                    "Could not allocate the specified port or a port in the range 4000-4100 " +
                    "for local host " + localMember.getHostname() +
                    ". Check whether the IP address specified or inferred for the local " +
                    "member is correct.";
            log.error(msg, e);
            throw new ClusteringFault(msg, e);
        }

        byte[] payload = "ping".getBytes();
        localMember.setPayload(payload);
        receiver.setPort(port);
        localMember.setPort(port);
        localMember.setDomain(localDomain);
        staticMembershipInterceptor.setLocalMember(localMember);

        // ------------ END: Configure and add the local member ---------------------

        // ------------ START: Add other members ---------------------
        for (Member member : members) {
            StaticMember tribesMember;
            try {
                tribesMember = new StaticMember(member.getHostName(), member.getPort(),
                                                0, payload);
            } catch (IOException e) {
                String msg = "Could not add static member " +
                             member.getHostName() + ":" + member.getPort();
                log.error(msg, e);
                throw new ClusteringFault(msg, e);
            }

            // Do not add the local member to the list of members
            if (!(Arrays.equals(localMember.getHost(), tribesMember.getHost()) &&
                  localMember.getPort() == tribesMember.getPort())) {
View Full Code Here

            !mbrScheme.equals(ClusteringConstants.MembershipScheme.WKA_BASED)) {
            String msg = "Invalid membership scheme '" + mbrScheme + "'. Supported schemes are " +
                         ClusteringConstants.MembershipScheme.MULTICAST_BASED + " & " +
                         ClusteringConstants.MembershipScheme.WKA_BASED;
            log.error(msg);
            throw new ClusteringFault(msg);
        }
        return mbrScheme;
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.clustering.ClusteringFault

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.