Package voldemort.rest

Examples of voldemort.rest.PutResponseSender


                                successfulPutVC = ((VectorClock) this.storeClient.putVersionedWithCustomTimeout(this.requestObject)).clone();
                            } else {
                                successfulPutVC = ((VectorClock) this.storeClient.putWithCustomTimeout(this.requestObject)).clone();
                            }

                            PutResponseSender responseConstructor = new PutResponseSender(messageEvent,
                                                                                          successfulPutVC,
                                                                                          this.storeClient.getStoreName(),
                                                                                          this.requestObject.getKey());
                            responseConstructor.sendResponse(this.coordinatorPerfStats,
                                                             true,
                                                             this.requestObject.getRequestOriginTimeInMs());

                            if(logger.isDebugEnabled()) {
                                logger.debug("PUT successful !");
                            }

                        } catch(Exception e) {
                            /*
                             * We might get InsufficientOperationalNodes
                             * exception due to a timeout, thus creating
                             * confusion in the root cause. Hence explicitly
                             * check for timeout.
                             */
                            if(System.currentTimeMillis() >= (this.requestObject.getRequestOriginTimeInMs() + this.requestObject.getRoutingTimeoutInMs())) {
                                RestErrorHandler.writeErrorResponse(this.messageEvent,
                                                                    REQUEST_TIMEOUT,
                                                                    "PUT request timed out: "
                                                                            + e.getMessage());
                            } else {
                                putErrorHandler.handleExceptions(messageEvent, e);
                            }
                        }

                        break;

                    case VoldemortOpCode.DELETE_OP_CODE:
                        if(logger.isDebugEnabled()) {
                            logger.debug("Incoming delete request");
                        }

                        try {
                            boolean isDeleted = this.storeClient.deleteWithCustomTimeout(this.requestObject);
                            if(isDeleted) {
                                DeleteResponseSender responseConstructor = new DeleteResponseSender(messageEvent,
                                                                                                    this.storeClient.getStoreName(),
                                                                                                    this.requestObject.getKey());
                                responseConstructor.sendResponse(this.coordinatorPerfStats,
                                                                 true,
                                                                 this.requestObject.getRequestOriginTimeInMs());

                                if(logger.isDebugEnabled()) {
                                    logger.debug("DELETE request successful !");
View Full Code Here


                        if(logger.isDebugEnabled()) {
                            logger.debug("Incoming put request");
                        }
                        try {
                            store.put(requestObject.getKey(), requestObject.getValue(), null);
                            PutResponseSender responseConstructor = new PutResponseSender(messageEvent);
                            responseConstructor.sendResponse(performanceStats,
                                                             fromLocalZone,
                                                             requestObject.getRequestOriginTimeInMs());
                        } catch(Exception e) {
                            putErrorHandler.handleExceptions(messageEvent, e);
                        }
                        break;

                    case VoldemortOpCode.DELETE_OP_CODE:
                        if(logger.isDebugEnabled()) {
                            logger.debug("Incoming delete request");
                        }
                        try {
                            boolean result = store.delete(requestObject.getKey(),
                                                          requestObject.getVersion());
                            if(!result) {
                                logger.error("Error when doing delete. Non Existing key/version. Nothing to delete");
                                RestErrorHandler.writeErrorResponse(messageEvent,
                                                                    NOT_FOUND,
                                                                    "Non Existing key/version. Nothing to delete");
                                break;
                            }
                            DeleteResponseSender responseConstructor = new DeleteResponseSender(messageEvent);
                            responseConstructor.sendResponse(performanceStats,
                                                             fromLocalZone,
                                                             requestObject.getRequestOriginTimeInMs());
                        } catch(Exception e) {
                            deleteErrorHandler.handleExceptions(messageEvent, e);
                        }
                        break;

                    case VoldemortOpCode.GET_VERSION_OP_CODE:

                        if(logger.isDebugEnabled()) {
                            logger.debug("Incoming get version request");
                        }
                        try {
                            List<Version> versions = store.getVersions(requestObject.getKey());

                            // handle non existing key
                            if(versions.size() > 0) {
                                GetVersionResponseSender responseConstructor = new GetVersionResponseSender(messageEvent,
                                                                                                            requestObject.getKey(),
                                                                                                            versions,
                                                                                                            storeName);
                                responseConstructor.sendResponse(performanceStats,
                                                                 fromLocalZone,
                                                                 requestObject.getRequestOriginTimeInMs());

                            } else {
                                logger.error("Error when doing getversion. Key does not exist or key is null");
View Full Code Here

TOP

Related Classes of voldemort.rest.PutResponseSender

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.