1 /* 2 * #%L 3 * NoOpCallback.java - mongodb-async-driver - Allanbank Consulting, Inc. 4 * %% 5 * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc. 6 * %% 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * #L% 19 */ 20 21 package com.allanbank.mongodb.client.callback; 22 23 import com.allanbank.mongodb.client.message.Reply; 24 25 /** 26 * NoOpCallback provides a callback that does nothing. 27 * 28 * @api.no This class is <b>NOT</b> part of the drivers API. This class may be 29 * mutated in incompatible ways between any two releases of the driver. 30 * @copyright 2014, Allanbank Consulting, Inc., All Rights Reserved 31 */ 32 public final class NoOpCallback implements ReplyCallback { 33 /** A no-op callback. */ 34 public static final NoOpCallback NO_OP = new NoOpCallback(); 35 36 /** 37 * {@inheritDoc} 38 * <p> 39 * Overridden to do nothing. 40 * </p> 41 */ 42 @Override 43 public void callback(final Reply result) { 44 // Nothing. 45 } 46 47 /** 48 * {@inheritDoc} 49 * <p> 50 * Overridden to do nothing. 51 * </p> 52 */ 53 @Override 54 public void exception(final Throwable thrown) { 55 // Nothing. 56 } 57 58 /** 59 * {@inheritDoc} 60 * <p> 61 * Overridden to return true. 62 * </p> 63 */ 64 @Override 65 public boolean isLightWeight() { 66 return true; 67 } 68 }