All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.geode.internal.admin.remote.AppCacheSnapshotMessage Maven / Gradle / Ivy

Go to download

Apache Geode provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing

There is a newer version: 1.15.1
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */


package org.apache.geode.internal.admin.remote;

import java.io.*;
// import org.apache.geode.internal.admin.*;
import org.apache.geode.distributed.internal.*;
import org.apache.geode.cache.*;
// import org.apache.geode.internal.cache.*;
import org.apache.geode.*;
// import java.util.*;

public final class AppCacheSnapshotMessage extends RegionAdminMessage {
  // private int numResults;
  // private static Map consolesToSnapshots = new HashMap();
  private int snapshotId;

  public static AppCacheSnapshotMessage create(String regionName, int snapshotId) {
    AppCacheSnapshotMessage m = new AppCacheSnapshotMessage();
    m.setRegionName(regionName);
    // m.numResults = numResults;
    m.snapshotId = snapshotId;
    return m;
  }

  @Override
  protected void process(DistributionManager dm) {
    Region r = getRegion(dm.getSystem());
    if (r != null) {
      try {
        // LinkedList entries = getEntriesForRegion(r, this.getSender());
        // new ResponseThread(this.getSender(), numResults, dm, this.snapshotId).start();
        SnapshotResultMessage m = SnapshotResultMessage.create(r, snapshotId);
        m.setRecipient(this.getSender());
        dm.putOutgoing(m);
      } catch (CacheException ex) {
        throw new GemFireCacheException(ex);
      }
    }
  }

  // public static synchronized void flushSnapshots(Serializable consoleAddr) {
  // consolesToSnapshots.remove(consoleAddr);
  // System.gc();
  // }

  // private static synchronized LinkedList getEntriesForRegion(Region r, Serializable recipient)
  // throws CacheException {
  // Object obj = consolesToSnapshots.get(recipient);
  // if (obj == null) {
  // boolean statsEnabled = r.getAttributes().getStatisticsEnabled();
  // LinkedList snaps = new LinkedList();

  // synchronized(r) {
  // Set entries = r.entries(false);
  // Set subRegions = r.subregions(false);
  // snaps.addLast(new RemoteRegionSnapshot(r)); //add region itself

  // for (Iterator iter = subRegions.iterator(); iter.hasNext(); ) {
  // snaps.addLast(new RemoteRegionSnapshot((Region)iter.next()));
  // }

  // for (Iterator iter = entries.iterator(); iter.hasNext(); ) {
  // snaps.addLast(new RemoteEntrySnapshot((Region.Entry)iter.next(), statsEnabled));
  // }
  // }

  // consolesToSnapshots.put(recipient, snaps);
  // return snaps;
  // } else {
  // return (LinkedList)obj;
  // }
  // }

  // private static synchronized CacheSnapshot[] extractElements(int numElements,
  // Serializable console) {
  // LinkedList ll = (LinkedList)consolesToSnapshots.get(console);
  // if (ll == null) {
  // return new CacheSnapshot[0];
  // }
  // numElements = (numElements > ll.size()) ? ll.size() : numElements;
  // CacheSnapshot[] snaps = new CacheSnapshot[numElements];
  // for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy