SIP:错误数据连接丢失

2024-03-31

我已经在 android 中使用本机 sip 创建了 sip 应用程序。在其中,我在从 sip 服务器取消注册帐户时遇到问题,每次我得到数据连接丢失我也在android文档中看到,但没有对此错误的简短解释。而且它在注册时面临各种错误,如in_progress、transaction_termminate等,这些错误在doc中没有适当的解释。 这是我的代码:

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.*;
import android.widget.Chronometer;
import android.net.sip.*;
import java.text.ParseException;
import commonUtilities.Prefs;

public class WalkieTalkieActivity extends Activity implements View.OnTouchListener {

    public String sipAddress = null;
    public SipManager manager = null;
    public SipProfile me = null;
    public SipAudioCall call = null;
    public SipErrorCode sipcode;
    public SipException sipexeception;
    public static WalkieTalkieActivity walkiy;

    public static WalkieTalkieActivity getInstance(Context c) {
        if (walkiy == null) {
            walkiy = new WalkieTalkieActivity();
        }
        return walkiy;
    }@
    Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        // "Push to talk" can be a serious pain when the screen keeps turning off.
        // Let's prevent that.
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        Log.e("onCreate", "onCreate");
        initializeManager(this);
    }@
    Override
    public void onStart() {
        super.onStart();
        // When we get back from the preference setting Activity, assume
        // settings have changed, and re-login with new auth info.
        initializeManager(this);
    }@
    Override
    public void onDestroy() {

        super.onDestroy();
        if (call != null) {
            call.close();
        }
        closeLocalProfile();
    }@
    Override
    protected void onResume() {
        // TODO Auto-generated method stub
        initializeManager(this);
        super.onResume();
    }
    public void initializeManager(Context ctx) {


        if (manager == null) {
            Log.e("initialising ", "ini manager");
            manager = SipManager.newInstance(ctx);
        }
        initializeLocalProfile(ctx);
    }

    public void initializeLocalProfile(final Context ctx) {
        if (manager == null) {
            updateStatus("Not Supporting.", ctx);
            Log.e("return", "manager is null ");
            return;
        }

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
        String username = prefs.getString("namePref", Prefs.getUserName(ctx));
        String domain = prefs.getString("domainPref", "255.235.472");
        String password = prefs.getString("passPref", Prefs.getUserPassword(ctx));

        if (username.length() == 0 || domain.length() == 0 || password.length() == 0) {
            return;
        }
        try {
            SipProfile.Builder builder = new SipProfile.Builder(username, domain);
            builder.setPassword(password);
            me = builder.build();
            Intent intent = new Intent();
            intent.setAction("android.SipDemo.INCOMING_CALL");
            PendingIntent pendingIntent = PendingIntent.getBroadcast(ctx, 0, intent, Intent.FILL_IN_DATA);
            manager.open(me, pendingIntent, null);

            if (!manager.isRegistered(me.getUriString())) {
                manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {

                    public void onRegistering(String localProfileUri) {
                        Log.e("Sip restration", "Registering with SIP Server...");
                        updateStatus("Registering with SIP Server...", ctx);
                    }

                    public void onRegistrationDone(String localProfileUri, long expiryTime) {
                        Log.e("Sip restration", "Ready");
                        updateStatus("Ready", ctx);
                    }

                    public void onRegistrationFailed(String localProfileUri, int errorCode,
                        String errorMessage) {
                        Log.e("Registration Error Code ", SipErrorCode.toString(errorCode) + errorCode);
                        updateStatus(errorCode + " " + SipErrorCode.toString(errorCode), ctx);
                    }
                });
            } else {
                Log.e("already register", "already register");
                updateStatus("Ready", ctx);
            }
        } catch (ParseException pe) {
            updateStatus("Connection Error.", ctx);
        } catch (SipException se) {
            updateStatus("Connection error.", ctx);
        }
    }

    public Boolean closeLocalProfile() {
        Log.e("Closing profile", "closing profile " + me.getUriString());

        if (manager == null) {
            return false;
        }
        try {
            if (me != null) {
                Log.e("Unregistering profile", "Un registering profile ");
                manager.unregister(me, null);
                manager.close(me.getUriString());
            }
        } catch (Exception ee) {
            Log.d("WalkieTalkieActivity/onDestroy", "Failed to close local profile.", ee);
        }
        return false;
    }
    public void initiateCall(String number, final Context ctx, final View v) {

        //      updateStatus(sipAddress);
        Log.d("Number", "" + number);
        sipAddress = number;
        Log.e("initiating call", "initiating call");
        try {
            SipAudioCall.Listener listener = new SipAudioCall.Listener() {@
                Override
                public void onCallBusy(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("buzy", "buzy");
                    super.onCallBusy(call);
                }@
                Override
                public void onCallHeld(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("held", "held");
                    super.onCallHeld(call);
                }@
                Override
                public void onCalling(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("calling", "calling");
                    super.onCalling(call);
                }@
                Override
                public void onChanged(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("changed", "changed");
                    super.onChanged(call);
                }@
                Override
                public void onError(SipAudioCall call, int errorCode,
                    String errorMessage) {
                    // TODO Auto-generated method stub
                    Log.e("call error", "error" + SipErrorCode.toString(errorCode));
                    CallingScreen.fa.finish();
                    super.onError(call, errorCode, errorMessage);

                }@
                Override
                public void onReadyToCall(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("ready to call", "ready to call ");
                    super.onReadyToCall(call);
                }@
                Override
                public void onRinging(SipAudioCall call, SipProfile caller) {
                    // TODO Auto-generated method stub
                    Log.e("ringing", "ringing");

                    super.onRinging(call, caller);
                }@
                Override
                public void onRingingBack(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("ringing back", "ringing back");
                    super.onRingingBack(call);
                }@
                Override
                public void onCallEstablished(SipAudioCall call) {
                    Log.e("call established", "call established");
                    call.startAudio();
                    updateTime(true, ctx);
                }@
                Override
                public void onCallEnded(SipAudioCall call) {
                    Log.e("call ended", "call ended");

                    updateTime(false, ctx);
                    CallingScreen.fa.finish();
                }
            };
            Log.e("param 1 ", "" + me.getUriString());
            call = manager.makeAudioCall(me.getUriString(), sipAddress + "@216.245.200.2:5060", listener, 30);
        } catch (Exception e) {
            e.printStackTrace();
            Log.i("WalkieTalkieActivity/InitiateCall", "Error when trying to close manager.", e);
            if (me != null) {
                try {
                    closeLocalProfile();
                } catch (Exception ee) {
                    ee.printStackTrace();
                    Log.i("WalkieTalkieActivity/InitiateCall",
                        "Error when trying to close manager.", ee);
                    ee.printStackTrace();
                }
            }
            if (call != null) {
                call.close();
            }
        }
    }
    public void updateStatus(final String status, final Context context) {
        // Be a good citizen.  Make sure UI changes fire on the UI thread.
        this.runOnUiThread(new Runnable() {
            public void run() {
                generateNotification(context, status);
            }
        });
    }
    public void updateTime(final Boolean status, final Context context) {
        // Be a good citizen.  Make sure UI changes fire on the UI thread.
        this.runOnUiThread(new Runnable() {
            public void run() {
                if (status) {
                    CallingScreen.fa.ch = (Chronometer) CallingScreen.fa.findViewById(R.id.time);
                    CallingScreen.fa.ch.setTypeface(CallingScreen.normal);
                    CallingScreen.fa.calling_screen_text.setVisibility(View.GONE);

                    CallingScreen.fa.ch.setVisibility(View.VISIBLE);
                    CallingScreen.fa.ch.start();
                } else {
                    CallingScreen.fa.ch.stop();
                }
            }
        });
    }

    public void updateStatus(SipAudioCall call) {
        String useName = call.getPeerProfile().getDisplayName();
        if (useName == null) {
            useName = call.getPeerProfile().getUserName();
        }
        //      updateStatus(useName + "@" + call.getPeerProfile().getSipDomain());
    }
    public boolean onTouch(View v, MotionEvent event) {
        if (call == null) {
            return false;
        } else if (event.getAction() == MotionEvent.ACTION_DOWN && call != null && call.isMuted()) {
            call.toggleMute();
        } else if (event.getAction() == MotionEvent.ACTION_UP && !call.isMuted()) {
            call.toggleMute();
        }
        return false;
    }
    public void endcall() {
        if (call != null) {
            try {
                call.endCall();
            } catch (SipException se) {
                Log.d("WalkieTalkieActivity/onOptionsItemSelected",
                    "Error ending call.", se);
            }
            call.close();
        }
    }
    public void speaker(Boolean speak) {
        if (call != null)
            call.setSpeakerMode(speak);
    }
    public static void generateNotification(Context context, String message) {
        int icon = R.drawable.ic_launcher;
        long when = System.currentTimeMillis();
        NotificationManager notificationManager = (NotificationManager)
        context.getSystemService(Context.NOTIFICATION_SERVICE);
        Notification notification = new Notification(icon, message, when);
        String title = context.getString(R.string.app_name);
        Intent notificationIntent = new Intent(context, Splash_screen.class);
        // set intent so it does not start a new activity
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
            Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent intent =
            PendingIntent.getActivity(context, 0, notificationIntent, 0);
        notification.setLatestEventInfo(context, title, message, intent);
        notificationManager.notify(0, notification);
    }
    public Boolean isRegistered() {
        if (manager != null && me != null)
            try {
                return manager.isRegistered(me.getUriString());
            } catch (SipException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();

            }
        return false;
    }

}

LOGCAT1

12 - 23 14: 19: 10.930: E / Unregistering profile(32139): Un registering profile
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): Failed to close local profile.
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): android.net.sip.SipException: SipService.createSession() returns null
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.net.sip.SipManager.unregister(SipManager.java: 507)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.phone91.android.WalkieTalkieActivity.closeLocalProfile(WalkieTalkieActivity.java: 144)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.phone91.android.DialerActivity$1$2.onClick(DialerActivity.java: 79)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java: 174)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.os.Handler.dispatchMessage(Handler.java: 99)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.os.Looper.loop(Looper.java: 155)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.app.ActivityThread.main(ActivityThread.java: 5520)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at java.lang.reflect.Method.invokeNative(Native Method)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at java.lang.reflect.Method.invoke(Method.java: 511)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 1029)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 796)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at dalvik.system.NativeStart.main(Native Method)

日志 CAT2:

12-23 14:53:28.890: E/Unregistering profile(2001): Un registering profile 
12-23 14:53:30.050: E/Registration Error Code(2001): DATA_CONNECTION_LOST-10

我一直在检查 SipDemo 示例代码,我假设您将其用作应用程序的参考,但在注册过程中也遇到了此错误。

在检查了 Android 的源代码(4.1)后,我发现这是堆栈实现中的一个错误。更详细:

  1. SIP服务注册和Intend监听器用于更新连接信息。
  2. 当您尝试过快地注册 SipRegistrationListener 时(通过使用setRegistrationListener),由于网络信息尚未更新(未收到意图),因此返回SipErrorCode.DATA_CONNECTION_LOST,但是,实际上,会话终于正确注册了。

在你的情况下,正如你所提供的SipRegistrationListener in unregister方法,此过程失败。一个丑陋的解决方法是等待一段时间才能收到意图,或者不提供侦听器。

您还会看到,如果您替换unregister打电话经过setRegistrationLister您仍然会收到相同的错误,因此,您还可以尝试创建一个高层管理人员,这是在onRegistrationDone回调,您可以设置一个标志来了解是否可以关闭配置文件。就像是:

public void updateStatus(final int status, final Context context) {
    if(status == STATUS_OK)
        registered = true;

    // Be a good citizen.  Make sure UI changes fire on the UI thread.
    this.runOnUiThread(new Runnable() {
        public void run() {
            generateNotification(context, statusToString(status));
        }
    });
}

并且,当关闭本地配置文件时:

public Boolean closeLocalProfile() {
    Log.e("Closing profile", "closing profile " + me.getUriString());

    if (manager == null || !registered) {
        return false;
    }
    try {
        if (me != null) {
            Log.e("Unregistering profile", "Un registering profile ");
            manager.unregister(me, null);
            manager.close(me.getUriString());
        }
    } catch (Exception ee) {
        Log.d("WalkieTalkieActivity/onDestroy", "Failed to close local profile.", ee);
    }
    return false;
}

请注意,我在中使用了一个整数updateStatus而不是字符串并使用辅助函数,statusToString将状态代码转换为字符串。

正如您可能注意到的,这将添加一个额外的管理层,该管理层最初应该已经在堆栈中,但事实并非如此。我不太确定这会修复所有返回错误(在检查源代码后我看到了几个可能的错误),但应该有所帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SIP:错误数据连接丢失 的相关文章

  • Android 主机意图过滤器通配符

    是否可以在 android host 属性上使用通配符 就像是 android host site com android pathPattern android pathPrefix m android scheme http gt Or
  • 在 Android 中创建和使用 9 补丁图像

    我最近听说了 9 补丁图像 我知道它是 9 平铺的并且是可拉伸的 我想了解更多 如何创建 9 块图像 有什么工具吗 我可以通过 AndroidSDK 或代码创建它吗 9 patch 相对于普通 png 的主要优点 它是否可以根据屏幕动态 自
  • 关闭 Android 中的飞行模式

    如果 num gt 50 我想关闭飞行模式 我实现了这段代码 来自在 Android 中切换飞行模式 https stackoverflow com questions 5533881 toggle airplane mode in and
  • 定期运行任务(每天一次/每周一次)

    我想定期 每周 每天一次 运行一些任务 即获取我的网站新闻页面 即使我的应用程序已关闭 是否可以 是的 您需要查看报警管理器 http developer android com reference android app AlarmMan
  • 如何检测和管理来电(Android)?

    我想创建一个应用程序 可以检测来电并在一定数量的蜂鸣声 响铃 后启动我的自定义活动 我的意思是在 2 或 3 或 5 声蜂鸣声 响铃 后我的activity被触发 我该怎么做 Thanks 我认为您无法计算自来电开始以来电话响了多少次 无法
  • Android中如何使用洪水填充算法?

    我是Android编程新手 最近尝试编写一个简单的应用程序 仅供练习 在这个中 我想在用户点击时为图像着色 但我不知道如何开始 我读过不同的主题 其中提到使用 洪水填充 算法 我在网上找到了它 但我不知道如何将它放入我的简单应用程序中 我找
  • Android 上的 Firebase:如何检查 Firebase 身份验证失败原因?

    我在 Android 上使用 Firebase 和 Firebase Auth 功能 I try FirebaseAuth signInWithEmailAndPassword如果失败 我想知道为什么登录过程失败 The signInWit
  • 显示警报或收到通知时的视图

    我正在关注this http tokudu com 2010 how to implement push notifications for android 显示的教程通知 on an 安卓设备 当我在设备上运行该应用程序时 状态栏上会出现
  • 如何将 EditText 传递给另一个活动?

    Intent intent new Intent this Name class intent putExtra key et getText toString startActivity intent Intent intent getI
  • Android - 当不在栏顶部时推送通知空白

    我在使用 Android 推送通知时遇到一个小问题 如果有 3 个通知 并且只有其中一个显示标题和消息 位于酒吧顶部的那个 如果有人知道可能是什么问题 请告诉我 请参阅此链接上的图像 这就是我接收通知的方式http postimg org
  • 如何在 Android 上创建 YouTube 的双击手势?

    我在 Android 上有 exoplayer 的应用程序 我已经创建了 youtube双击手势用动画向前或向后跳跃 10 秒 如何在双击时创建具有波纹效果的半圆 像这样 这个怎么做 我也想实现这样的功能 所以我自己编写了它来 复制 You
  • Android Studio - 如何关闭“单词‘word’中的拼写错误?”

    当命名变量或给出字符串参数时 Android Studio 似乎对我如何标记事物有问题 有办法把它关掉吗 是的 打开Preferences gt Editor gt Inspections gt Spelling gt 关闭Typo并按OK
  • android 确定设备是否采用从右到左的语言/布局

    有没有办法确定设备是否使用从右到左的语言 例如阿拉伯语 而不是从左到右的语言 英语 与较旧的 API 级别 低至 10 兼容的东西是必要的 SOLUTION 我最终在接受的答案中使用了 xml 方法 接下来 我还添加了此处指示的代码 以应对
  • 从多个选项卡中的编辑文本字段获取文本

    我正在尝试创建一个使用选项卡作为输入表单的 Android 应用程序 基本上 我希望对其进行设置 以便用户可以在一个选项卡上输入一些信息 然后提交该信息 或者转到另一个选项卡并输入更多信息 然后从两个选项卡提交信息 我正在使用操作栏和片段来
  • window.onbeforeunload 在 Android Chrome 上不会触发 [alt.解决方案?]

    我开发了一个简单的聊天应用程序 我正在使用 window onbeforeunload当有人关闭选项卡 浏览器时 基本上是当用户离开房间时 通知其他用户 这是我的代码 scope onExit function scope chatstat
  • Google 移动广告和 Kindle Fire

    我最近用 Google 移动广告替换了 AdMob 库 对此我有一个疑问 广告会出现在 Amazon Kindle Fire 设备上吗 我问这个是因为我知道 Google 移动广告依赖于 Google Play 服务 所以我有点困惑 Goo
  • Android模拟器分配内存失败8

    当我尝试从 Eclipse 运行 WXGA800 模拟器时 出现如下错误 Failed to allocate memory 8 This application has requested the Runtime to terminate
  • 如何在android中的操作栏中创建Edittext?

    我们可以在操作栏中使用编辑文本吗 在阅读了 Google 中的大量资源后 我找不到如何在操作栏中创建编辑文本 谁能告诉我该怎么做 您可以设置自定义View为了ActionBar像这样 getActionBar setCustomView R
  • 如何获取android手机型号、版本、sdk详细信息?

    如何获取android手机型号 版本 sdk详细信息 首先 看看 android sdk 页面上的这些 Build 类 http developer android com reference android os Build html h
  • 在 Android 中上传文件出现内存不足错误

    我的上传代码如下 String end r n String twoHyphens String boundary try URL url new URL ActionUrl HttpURLConnection con HttpURLCon

随机推荐

  • 如何通过 Java SDK 使用 AWS 端口转发会话

    我正在使用开始一个会话AWSSimpleSystemsManagementAsync如下 Map
  • VS2008 声明数组时出现预期常量表达式错误,但在 GCC 中此代码没有错误

    我有以下功能 void someFun int ar const int size int newAr size do something 我在这一行得到三个错误 Error 1 error C2057 expected constant
  • 调用 .disconnect() 后如何重新连接

    问题 发布手册后如何重新连接客户端到服务器 disconnect 在我当前的项目中 当用户从会话注销时 我需要断开客户端与服务器的连接 我做了一个socket disconnect 才能成功断开连接 服务器从会话中删除了用户 一段时间后 用
  • 如何开始使用 Selenium 2?

    我到处读到我们should现在使用 Selenium 2 如果我的理解正确的话 WebDriver 我不是在谈论 Selenium IDE 它确实很容易使用 我已经阅读了 Selenium 网站上的文档 该文档声称不完整 因为 Seleni
  • Visual Studio 扩展未知错误 - 无法推送或获取任何内容

    当我尝试通过 Visual Studio 的 Git 扩展将任何内容推送到我的 bitbucket 存储库时出现错误 Error encountered while pushing branch to the remote reposito
  • QTableView 中的搜索/查找功能

    我有一个 QWidget 里面有一个 QTableView 我需要在表格的第一列上有查找功能 因此当我单击 Ctrl F 时 会弹出一个查找对话框 class Widget QWidget def init self md parent N
  • 如何在c中增加数组

    我试图使用变量作为增量来增加 int 数组 但它会引发错误 int array MAXSIZE int n fill the array with some numbers some other code 这里的情况是 一旦我分析了前 n
  • Javascript:了解原型链

    我创建了一个简单的类 如下所示 var Class function Class prototype testObj a 2 b 3 现在如果我这样做console log Class testObj I get undefined 但是如
  • 为什么这个 c# 代码片段是合法的?

    愚蠢的问题 但是为什么下面的行会编译 int i new int 1 正如您所看到的 我没有输入第二个元素并在那里留下了逗号 即使您希望它不会编译 仍然可以编译 我想是因为 ECMA 334 标准说 array initializer va
  • 简单的 jQuery 回调在 IE 中中断

    我有几个这样的功能 this find subnav fadeIn 200 buttonHide Now 按钮隐藏 在本例中 是我在其他地方声明的函数 一旦 200ms fadeIn 完成 我想调用该函数 伟大的 适用于 FF 和 Safa
  • 带有平滑流格式 SDK 的基于 IIS 的 HLS

    我正在尝试通过 IIS 运行 HLS 并且通过 Silverlight 进行平滑流处理工作正常 但 HLS 不行 我拥有的 新的实时平滑流媒体发布点启用了 HLS 支持 通过 Smooth Streaming Format SDK 连接 P
  • 如何将 microsoft graph 365 用户个人资料照片从二进制数据转换为可读图像格式

    我已在 PHP 中使用 Microsoft Graph API 成功显示了有关管理员用户配置文件照片的信息 下面是我使用的代码
  • 向量(插入然后排序)或集合哪种方法更快?

    我有数字序列 未排序 无重复 目标是对它们进行排序 方法一 插入向量 O n 使用排序算法并排序 O nlogn 方法2 插入集合 o nlogn 哪种方法会更快 我觉得设置会更快 因为向量中的每个插入都必须分配 完整的数组元素并复制它然后
  • 通过从客户区的一部分拖动无框窗口来移动它

    正如标题所示 我想仅当用户将窗口从客户区域的一部分拖动时才移动窗口 这将是对正常标题栏移动的模仿 这是因为我的表单是自定义的 并且没有任何标题或标题栏 目前 我使用的代码如下 case WM NCHITTEST return HTCAPTI
  • 你能用 Java 获得基本的 GC 统计数据吗?

    我想让一些长时间运行的服务器应用程序定期输出 Java 中的一般 GC 性能数据 例如 Runtime freeMemory 的 GC 等价物 例如完成的周期数 平均时间等 我们的系统在客户机器上运行 怀疑配置错误的内存池导致了过多的 GC
  • 仅旋转特定 Excel 行中的文本

    我想使用以下命令旋转 Excel 文件中的标题Microsoft Office Interop 为了实现这一目标 我使用以下代码 worksheet Range A1 worksheet UsedRange Columns Count 1
  • HTTP 标头中什么被视为空白

    我刚刚阅读了 HTTP 标准 拟议标准更准确地说 第 1 部分 并对第 3 节倒数第二段中他们认为的 空白 感到困惑 https www rfc editor org rfc rfc7230 section 3 https www rfc
  • 在 Visual Studio 2008 for .NET CF 中处理不同分辨率

    我正在开发一个基于 NET CF 的图形应用程序 我的项目涉及大量绘图图像 我们决定在不同的手机分辨率上移植该应用程序 240 X 240 480 X 640 等 我将如何在单个解决方案 项目中实现这一目标 是否需要根据决议创建不同的项目
  • R 错误:java.lang.OutOfMemoryError:Java 堆空间

    我正在尝试将 R 连接到 Teradata 以将数据直接提取到 R 中进行分析 但是 我收到错误 Error in jcall rp I fetch stride block java lang OutOfMemoryError Java
  • SIP:错误数据连接丢失

    我已经在 android 中使用本机 sip 创建了 sip 应用程序 在其中 我在从 sip 服务器取消注册帐户时遇到问题 每次我得到数据连接丢失我也在android文档中看到 但没有对此错误的简短解释 而且它在注册时面临各种错误 如in