⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blobtest.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: BLOBTest.java,v 1.4 2000/10/28 16:55:20 daniela Exp $package org.ozoneDB.test;import java.io.*;import java.util.*;import java.util.zip.*;import org.ozoneDB.*;import org.ozoneDB.util.*;class BLOB extends Thread {            final static int POOLSIZE = 10;    final static int BUFFERSIZE = 32000;    final static int PAGESIZE = 32;    final static int MINSIZE = 1;    final static int MAXSIZE = 1024;        int pool;    int bsize;    int page;    int min;    int max;        String[] names;    int[] sizes;    byte[] buffer;    long[] check;    RemoteDatabase db;        Random objNr;    Random objSize;        boolean halted = false;        long movement = 0;    long avWritespeed = 0;    int writecount = 0;    long avReadspeed = 0;    int readcount = 0;            /** Constructor */    public BLOB( RemoteDatabase _db, int _poolsize, int _buffersize, int _pagesize, int _rangeMin, int _rangeMax ) {                pool = _poolsize;        bsize = _buffersize;        page = _pagesize;        min = _rangeMin;        max = _rangeMax;                names = new String[pool];        sizes = new int[pool];        check = new long[pool];        buffer = new byte[_buffersize];        db = _db;                objNr = new Random();        objSize = new Random();    }            /**  RUN THE THREAD */    public void run() {                int size;                while (true) {                        int actObj = objNr.nextInt() % pool;            actObj = actObj < 0 ? -actObj : actObj;                        try {                if (names[actObj] == null) {                    // at this place there isnt an object yet -> create one                    if (halted) {                        break;                    }                     createBlob( actObj );                } else {                    // there is one -> try to find it                    BLOBContainer blob = (BLOBContainer)db.objectForName( names[actObj] );                    if (blob != null) {                        // read and verify it                        if (halted) {                            break;                        }                         verifyBlob( blob, actObj );                        // delete it                        db.deleteObject( blob );                        names[actObj] = null;                        sizes[actObj] = 0;                        check[actObj] = 0;                        System.out.println( " -> deleted." );                        // create a new one                        if (halted) {                            break;                        }                         createBlob( actObj );                    } else {                        System.out.println( "\nERROR!!! Object for name 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -